Exemple #1
0
        private void HandleCurrentShip()
        {
            BattleshipAssestProvider assetsprovider = new BattleshipAssestProvider(CurrentShip);

            // Shoot first
            var canons = assetsprovider.GetCanons();
            var radars = assetsprovider.GetRadars();

            var weaponscombi = new CanonAndRadarCombiList(canons, radars);

            IEnumerable <Missile> missiles = Shoot(weaponscombi, CurrentShip);

            this.FiredMissiles.AddRange(missiles);

            var incommin = new IncommingMissiles(TheSea, missiles);

            incommin.Launch();

            // show animations
            ShowAnimations(missiles);

            // Move
            var sail = new SailAway(CurrentShip, TheSea);

            sail.Navigate();
        }
Exemple #2
0
        private IEnumerable <Missile> Shoot(CanonAndRadarCombiList weaponcombi, BattleShip battleship)
        {
            ICollection <Missile> missiles = new List <Missile>();

            foreach (Tuple <IKanon, IRadar> weapons in weaponcombi)
            {
                ICoordinate coordinate = TakeShot(weapons);
                Missile     missile    = new Missile(coordinate, battleship);

                missiles.Add(missile);
            }

            return(missiles);
        }