Beispiel #1
0
        private FireShotResponse Shot(Player victim, Player Shoter, out Coordinate ShotPoint)
        {
            FireShotResponse fire; Coordinate WhereToShot;

            do
            {
                WhereToShot = ControlInput.GetShotLocationFromUser();
                fire        = victim.PlayerBoard.FireShot(WhereToShot);
                if (fire.ShotStatus == ShotStatus.Invalid || fire.ShotStatus == ShotStatus.Duplicate)
                {
                    ControlOutput.ShowShotResult(fire, WhereToShot, "");
                }


                if (fire.ShotStatus == ShotStatus.Victory)
                {
                    if (gm.IsPlayer1)
                    {
                        gm.Player1.Win += 1;
                    }
                    else
                    {
                        gm.Player2.Win += 1;
                    }
                }
            } while (fire.ShotStatus == ShotStatus.Duplicate || fire.ShotStatus == ShotStatus.Invalid);
            ShotPoint = WhereToShot;
            return(fire);
        }
Beispiel #2
0
        private FireShotResponse Shot(Player victim, Player Shoter, out Coordinate ShotPoint)
        {
            FireShotResponse fire; Coordinate WhereToShot;

            do
            {
                WhereToShot = ControlInput.GetShotLocationFromUser();
                fire        = victim.PlayerBoard.FireShot(WhereToShot);
                if (fire.ShotStatus == ShipHitCheck.Invalid || fire.ShotStatus == ShipHitCheck.Duplicate)
                {
                }
            } while (fire.ShotStatus == ShipHitCheck.Duplicate || fire.ShotStatus == ShipHitCheck.Invalid);
            ShotPoint = WhereToShot;
            return(fire);
        }