Example #1
0
        public void CreateEnemyByTime()
        {
            if (NumEnemyOnField < ConstantValue.NUM_ALL_ENEMY)
            {
                CharacteristicTank newCharacter = GameManager.GetRandomChracterTank();

                Enemy = new EnemyTank(newCharacter, Direction.Down, GetCoorrdinateForNewEnemy(),
                                      ColorSkin.Gray, this);

                NumEnemyOnField++;
            }
        }
Example #2
0
        private bool CheckEnemiesTank()    // check that one enemy dead
        {
            bool win = false;

            List <EnemyTank> delEnemy = new List <EnemyTank>(_enemies.Count);

            foreach (EnemyTank item in _enemies)
            {
                if (item.Characteristic.HP <= 0)
                {
                    if (_getEnemyDeaded != null)
                    {
                        _getEnemyDeaded(item);

                        if (_enemyDead != null)
                        {
                            _enemyDead();
                        }

                        delEnemy.Add(item);
                    }
                }
            }

            foreach (EnemyTank item in delEnemy)
            {
                _enemies.Remove(item);

                if (NumEnemyOnField < ConstantValue.NUM_ALL_ENEMY)
                {
                    CharacteristicTank newCharacter = GameManager.GetRandomChracterTank();

                    Enemy = new EnemyTank(newCharacter, Direction.Down, GetCoorrdinateForNewEnemy(),
                                          ColorSkin.Gray, this);

                    NumEnemyOnField++;
                }
            }

            if (_enemies.Count == 0)
            {
                win = true;
            }

            return(win);
        }
        public static CharacteristicTank GetRandomChracterTank()
        {
            int randomNum = rndCharacterTank.Next(1, ConstantValue.NUM_RND_CHARAC);
            CharacteristicTank characterTank = null;

            switch (randomNum)
            {
            case 1:
                characterTank = new CharacteristicTank(ConstantValue.HP_LIGHT, 1, 1,
                                                       ConstantValue.ATACK_RANGE_LIGHT, ConstantValue.ATACK_DAMAGE_LIGHT,
                                                       SkinTank.Light);
                break;

            case 2:
                characterTank = new CharacteristicTank(ConstantValue.HP_DESTROY, 1, 1,
                                                       ConstantValue.ATACK_RANGE_DESTROY, ConstantValue.ATACK_DAMAGE_DESTROY,
                                                       SkinTank.Destroy);
                break;

            case 3:
                characterTank = new CharacteristicTank(ConstantValue.HP_HEAVY, 1, 1,
                                                       ConstantValue.ATACK_RANGE_HEAVY, ConstantValue.ATACK_DAMAGE_HEAVY,
                                                       SkinTank.Heavy);
                break;

            case 4:
                characterTank = new CharacteristicTank(ConstantValue.HP_DESTROY, 1, 1,
                                                       ConstantValue.ATACK_RANGE_DESTROY, ConstantValue.ATACK_DAMAGE_DESTROY,
                                                       SkinTank.Destroy);
                break;

            case 5:
                characterTank = new CharacteristicTank(ConstantValue.HP_LIGHT, 1, 1,
                                                       ConstantValue.ATACK_RANGE_LIGHT, ConstantValue.ATACK_DAMAGE_LIGHT,
                                                       SkinTank.Light);
                break;
            }

            return(characterTank);
        }
Example #4
0
 public EnemyTank(CharacteristicTank character, Direction direction,
                  Coordinate coordinate, ColorSkin skin, IField gameField)
     : base(character, direction, coordinate, skin, gameField)
 {
 }
Example #5
0
 public Tank(CharacteristicTank character, Direction direction, Coordinate coordinate,
             ColorSkin skin, IField gameField) : base(coordinate, skin, gameField)
 {
     Characteristic = character;
     DirectionTank  = direction;
 }