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

            return(firingShip);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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();
            }
        }