• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AttackResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AttackResult的典型用法代码示例。如果您正苦于以下问题:C# AttackResult类的具体用法?C# AttackResult怎么用?C# AttackResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AttackResult类属于命名空间,在下文中一共展示了AttackResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ProcessShot

 /// <summary>
 /// Process shot will throw an exception in the case of AI error resulting in a square being hit twice
 /// </summary>
 /// <param name="result">The result of the shot</param>
 /// <param name="row">the row shot</param>
 /// <param name="col">the column shot</param>
 protected override void ProcessShot(int row, int col, AttackResult result)
 {
     if (result.Value == ResultOfAttack.ShotAlready)
     {
         throw new ApplicationException("Error in AI");
     }
 }
开发者ID:jasontash,项目名称:Battleship,代码行数:13,代码来源:AIEasyPlayer.cs


示例2: ProcessShot

    /// <summary>
    /// ProcessShot will be called uppon when a ship is found.
    /// It will create a stack with targets it will try to hit. These targets
    /// will be around the tile that has been hit.
    /// </summary>
    /// <param name="row">the row it needs to process</param>
    /// <param name="col">the column it needs to process</param>
    /// <param name="result">the result og the last shot (should be hit)</param>
    protected override void ProcessShot(int row, int col, AttackResult result)
    {
        if (result.Value == ResultOfAttack.Hit) {
            _CurrentState = AIStates.Searching;

        } else if (result.Value == ResultOfAttack.ShotAlready) {
            throw new ApplicationException("Error in AI");
        }
    }
开发者ID:Nothing07,项目名称:BattleShips,代码行数:17,代码来源:AIEasyPlayer.cs


示例3: ProcessShot

 /// <summary>
 /// ProcessShot will be called uppon when a ship is found.
 /// It will create a stack with targets it will try to hit. These targets
 /// will be around the tile that has been hit.
 /// </summary>
 /// <param name="row">the row it needs to process</param>
 /// <param name="col">the column it needs to process</param>
 /// <param name="result">the result og the last shot (should be hit)</param>
 protected override void ProcessShot(int row, int col, AttackResult result)
 {
     if (result.Value == ResultOfAttack.Hit) {
         _CurrentState = AIStates.TargetingShip;
         AddTarget(row - 1, col);
         AddTarget(row, col - 1);
         AddTarget(row + 1, col);
         AddTarget(row, col + 1);
     } else if (result.Value == ResultOfAttack.ShotAlready) {
         throw new ApplicationException("Error in AI");
     }
 }
开发者ID:6942555,项目名称:battleship,代码行数:20,代码来源:AIMediumPlayer.cs


示例4: Show

	public void Show(AttackResult result)
	{
		gameObject.SetActive(true);

		labelNumber.color = result.IsCritical ? Color.red : Color.white;
        transform.localScale = Vector3.one * 4;
        tween.DORewind();
        tween.DOPlayForward();

		if (!result.IsDodge)
		{
			Show(result.Damage.ToString());
		}
		else
		{
			Show("Miss");
		}
	}
开发者ID:sigmadruid,项目名称:NewMaze,代码行数:18,代码来源:NumberItem.cs


示例5: PlayerAttacked

 public override void PlayerAttacked(BasePlayer player, Point from, Point to, GamePieceType piece, AttackResult result)
 {
     EstimatedState[from.x, from.y] = null;
     if (result == AttackResult.Win)
     {
         if (player != this)
         {
             EstimatedState[to.x, to.y] = GamePieceFactory.Create(piece, !this.IsRed);
         }
     }
     else if (result == AttackResult.Tie)
     {
         EstimatedState[to.x, to.y] = null;
     }
     else if (result == AttackResult.Lose)
     {
         if (player == this)
         {
             EstimatedState[to.x, to.y] = GamePieceFactory.Create(piece, !this.IsRed);
         }
     }
 }
开发者ID:smelch,项目名称:Stratego,代码行数:22,代码来源:BaseAIPlayer.cs


示例6: Attack

 public Attack()
 {
     this.result = AttackResult.Unknown;
 }
开发者ID:scottvossen,项目名称:BattleShip,代码行数:4,代码来源:IPlayer.cs


示例7: ProcessShot

 /// <summary>
 /// ProcessShot will be called uppon when a ship is found.
 /// </summary>
 /// <param name="row">the row it needs to process</param>
 /// <param name="col">the column it needs to process</param>
 /// <param name="result">the result og the last shot (should be hit)</param>
 protected override void ProcessShot(int row, int col, AttackResult result)
 {
     //easyAI does nothing with a shot
 }
开发者ID:Zalectrial,项目名称:Battleships,代码行数:10,代码来源:AIEasyPlayer.cs


示例8: UpdateAttackResults

        public void UpdateAttackResults(Coordinate lastAttack, AttackResult result, bool sunkShip)
        {
            if (uiState == UIState.Attacking)
            {
                uiState = UIState.WaitingToAttack;
                ShowNotification(string.Format("Waiting for {0} to attack...", opponent.PlayerName));
            }
            else { HandleBadUIState(); }

            // update attacks and ui elements
            Attacks[lastAttack.X, lastAttack.Y].Result = result;
        }
开发者ID:scottvossen,项目名称:BattleShip,代码行数:12,代码来源:MainWindow.xaml.cs


示例9: GetImageForAttackResult

 private Uri GetImageForAttackResult(AttackResult result)
 {
     switch (result)
     {
         default:
         case AttackResult.Unknown:
             return new Uri("resources/images/attacks/attackResult_Unknown.png", UriKind.Relative);
         case AttackResult.Miss:
             return new Uri("resources/images/attacks/attackResult_Miss.png", UriKind.Relative);
         case AttackResult.Hit:
             return new Uri("resources/images/attacks/attackResult_Hit.png", UriKind.Relative);
     }
 }
开发者ID:scottvossen,项目名称:BattleShip,代码行数:13,代码来源:MainWindow.xaml.cs


示例10: AttackCompleted

	/// <summary>
	/// Listens for attacks to be completed.
	/// </summary>
	/// <param name="sender">the game</param>
	/// <param name="result">the result of the attack</param>
	/// <remarks>
	/// Displays a message, plays sound and redraws the screen
	/// </remarks>
	private static void AttackCompleted(object sender, AttackResult result)
	{
		bool isHuman = false;
		isHuman = object.ReferenceEquals(_theGame.Player, HumanPlayer);

		if (isHuman) {
			Message = "You " + result.ToString();
		} else {
			Message = "The AI " + result.ToString();
		}

		switch (result.Value) {
			case ResultOfAttack.Destroyed:
				PlayHitSequence(result.Row, result.Column, isHuman);
				Audio.PlaySoundEffect(GameSound("Sink"));

				break;
			case ResultOfAttack.GameOver:
				PlayHitSequence(result.Row, result.Column, isHuman);
				Audio.PlaySoundEffect(GameSound("Sink"));

				while (Audio.SoundEffectPlaying(GameSound("Sink"))) {
					SwinGame.Delay(10);
					SwinGame.RefreshScreen();
				}

				if (HumanPlayer.IsDestroyed) {
					Audio.PlaySoundEffect(GameSound("Lose"));
				} else {
					Audio.PlaySoundEffect(GameSound("Winner"));
				}

				break;
			case ResultOfAttack.Hit:
				PlayHitSequence(result.Row, result.Column, isHuman);
				break;
			case ResultOfAttack.Miss:
				PlayMissSequence(result.Row, result.Column, isHuman);
				break;
			case ResultOfAttack.ShotAlready:
				Audio.PlaySoundEffect(GameSound("Error"));
				break;
		}
	}
开发者ID:shameera0020,项目名称:BattleShips-2.0,代码行数:52,代码来源:GameController.cs


示例11: AttackInfo

 public AttackInfo(Coordinate coord, AttackResult result, bool sunkShip)
 {
     this.coord = coord;
     this.result = result;
     this.sunkShip = sunkShip;
 }
开发者ID:scottvossen,项目名称:BattleShip,代码行数:6,代码来源:IPlayer.cs


示例12: UpdateAttackResults

 public void UpdateAttackResults(Coordinate lastAttack, AttackResult result, bool sunkShip)
 {
     ((MainWindow)wdw).Dispatcher.Invoke(new UpdateAttackResultsDelegate(wdw.UpdateAttackResults),
         lastAttack, result, sunkShip);
 }
开发者ID:scottvossen,项目名称:BattleShip,代码行数:5,代码来源:IPlayer.cs


示例13: CombatMessageFromResult

        private static string CombatMessageFromResult(Unit source, Unit target, String skill, AttackResult attackResult, int damage)
        {
            var effectString = String.Empty;
            switch (attackResult) {
                case AttackResult.Hit:
                    effectString = String.Format("dealing {0} damage", damage);
                    break;
                case AttackResult.Miss:
                    effectString = String.Format("but misses, dealing no damage.");
                    break;
                case AttackResult.Critical:
                    effectString = String.Format("dealing a critical blow for {0} total damage!", damage);
                    break;
                case AttackResult.Glancing:
                    effectString = String.Format("dealing {0} damage with a glancing attack", damage);
                    break;
            }

            return String.Format("{0} fires off a {1} at {2}, {3}.",
                source.Name,
                skill,
                target.Name,
                effectString);
        }
开发者ID:ndssia,项目名称:WindowsRobotGame,代码行数:24,代码来源:CombatManager.cs


示例14: Create

	public static NumberItem Create(Vector3 worldPosition, AttackResult result)
	{
        NumberItem numberItem = DoCreate(worldPosition);
		numberItem.Show(result);
		return numberItem;
	}
开发者ID:sigmadruid,项目名称:NewMaze,代码行数:6,代码来源:NumberItem.cs


示例15: TotalDamageFromResult

        private static int TotalDamageFromResult(AttackResult attackResult, int damage)
        {
            switch (attackResult) {
                case AttackResult.Hit:
                    return damage;
                case AttackResult.Miss:
                    return 0;
                case AttackResult.Critical:
                    return damage * 2;
                case AttackResult.Glancing:
                    return damage / 2;
            }

            return 0;
        }
开发者ID:ndssia,项目名称:WindowsRobotGame,代码行数:15,代码来源:CombatManager.cs


示例16: UnitStrike

        public UnitStrike( Unit attacker, Unit attackee, MeleeWeapon weapon )
            : base("Strike", attacker)
        {
            this.attacker = attacker;
            this.attackee = attackee;
            this.weapon = weapon;

            result = attacker.relations.GetAttackResult( attackee );
        }
开发者ID:choephix,项目名称:G11,代码行数:9,代码来源:ProcessBook+Units.cs


示例17: UnitShoot

        public UnitShoot( Unit attacker, Unit attackee, Firearm weapon )
            : base("Shoot", attacker)
        {
            this.attacker = attacker;
            this.attackee = attackee;
            this.weapon = weapon;

            result = attacker.relations.GetAttackResult( attackee );
        }
开发者ID:choephix,项目名称:G11,代码行数:9,代码来源:ProcessBook+Units.cs


示例18: UnitAttack

        public UnitAttack( Unit attacker, Unit attackee )
            : base("Attack", attacker)
        {
            this.attacker = attacker;
            this.attackee = attackee;

            result = attacker.relations.GetAttackResult( attackee );
            weapon = attacker.currentWeapon;
        }
开发者ID:choephix,项目名称:G11,代码行数:9,代码来源:ProcessBook+Units.cs


示例19: PlayerAttacked

 public abstract void PlayerAttacked(BasePlayer player, Point from, Point to, GamePieceType piece, AttackResult result);
开发者ID:smelch,项目名称:Stratego,代码行数:1,代码来源:BasePlayer.cs


示例20: Shoot

    /// <summary>
    /// Shoot will swap between players and check if a player has been killed.
    /// It also allows the current player to hit on the enemygrid.
    /// </summary>
    /// <param name="row">the row fired upon</param>
    /// <param name="col">the column fired upon</param>
    /// <returns>The result of the attack</returns>
    public AttackResult Shoot(int row, int col)
    {
        AttackResult newAttack = default(AttackResult);
        int otherPlayer = (_playerIndex + 1) % 2;

        newAttack = Player.Shoot(row, col);

        //Will exit the game when all players ships are destroyed
        if (_players[otherPlayer].IsDestroyed) {
            newAttack = new AttackResult(ResultOfAttack.GameOver, newAttack.Ship, newAttack.Text, row, col);
        }

        if (AttackCompleted != null) {
            AttackCompleted(this, newAttack);
        }

        //change player if the last hit was a miss
        if (newAttack.Value == ResultOfAttack.Miss) {
            _playerIndex = otherPlayer;
        }

        return newAttack;
    }
开发者ID:Nothing07,项目名称:BattleShips,代码行数:30,代码来源:BattleShipsGame.cs



注:本文中的AttackResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AttackType类代码示例发布时间:2022-05-24
下一篇:
C# AttackPayload类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap