Exemplo n.º 1
0
        public Result Attack(Player attacker, Square s)
        {
            if (!s.WasBombed && turn == attacker)
            {
                Result r = s.Bomb();

                if (r == Result.Miss)
                {
                    SwitchTurns();
                }

                else if (r == Result.ShipDestroyed)
                {
                    turn.ShipDestroyed();

                    if (turn.HasLost())
                    {
                        return(Result.Victory);
                    }
                }

                return(r);
            }
            return(Result.None);
        }
Exemplo n.º 2
0
        public void Attack()
        {
            clicked = true;
            s.Bomb();

            if (this.s.GetShip() == null)
            {
                this.Image = Properties.Resources.empty;
            }

            else
            {
                this.Image = Properties.Resources.bombed;
            }
        }