예제 #1
0
        public void Notify(Cell changedCell)
        {
            PlayerOneListener.Update(IsPlayerOneTurn, changedCell);
            PlayerTwoListener.Update(!IsPlayerOneTurn, changedCell);

            //don`t change turn if ship got hit
            if (changedCell.CellState != CellState.DamagedShip)
            {
                IsPlayerOneTurn = !IsPlayerOneTurn;
            }
        }
예제 #2
0
 public void Notify()
 {
     if (IsPlayerOneTurn)
     {
         PlayerOneListener.Update("You have won!");
         PlayerTwoListener.Update("You are loser, чел.");
     }
     else
     {
         PlayerTwoListener.Update("You have won!");
         PlayerOneListener.Update("You are loser, чел.");
     }
 }
예제 #3
0
 public void Notify(Exception exception)
 {
     if (IsPlayerOneTurn)
     {
         PlayerOneListener.Update("ERROR: " + exception.Message + " Try again.");
         PlayerTwoListener.Update("");
     }
     else
     {
         PlayerTwoListener.Update("ERROR: " + exception.Message + " Try again.");
         PlayerOneListener.Update("");
     }
 }