Beispiel #1
0
        private EnemyShip selectFiringShip(int amountOfShipsToFire,
                                           List <EnemyShip> firingShips)
        {
            var firingShipIndex = RandomUtil.GetNextRandomFromMax(amountOfShipsToFire);
            var firingShip      = firingShips[firingShipIndex];

            return(firingShip);
        }
Beispiel #2
0
        private void fireMultipleShips(List <EnemyShip> firingShips)
        {
            var amountOfShipsToFire = RandomUtil.GetNextRandomFromMax(firingShips.Count());

            for (var i = 0; i < amountOfShipsToFire; i++)
            {
                var firingShip = this.selectFiringShip(amountOfShipsToFire, firingShips);
                this.fireShipWhenShipHasNotFired(firingShip);
            }
        }
Beispiel #3
0
        private void addBonusEnemyToGame()
        {
            var randomInt = RandomUtil.GetNextRandomFromMax(30);

            if (this.bonusEnemyShip == null)
            {
                this.bonusEnemyShip = (EnemyShip)ShipFactory.SelectShip(ShipFactory.ShipSelections.BonusShip);
                this.currentBackground.Children.Add(this.bonusEnemyShip.Sprite);
                this.placeBonusEnemyShip();
            }
        }