Ejemplo n.º 1
0
 public bool IsSamePosition(GameMovement gameMovement)
 {
     if (gameMovement.PositionX == PositionX && gameMovement.PositionY == PositionY)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
 public override void ProcessTurn()
 {
     if (m_movements.Any())
     {
         GameMovement gameMovement = m_movements.First();
         m_movements.Remove(gameMovement);
         m_movements.Add(gameMovement);
         MoveTo(gameMovement.PositionX, gameMovement.PositionY);
     }
 }
Ejemplo n.º 3
0
 private GameMovement ProcessMovement(GameMovement gameMovement)
 {
     if (gameMovement.PositionX >= 0 && gameMovement.PositionX < m_map.Width && gameMovement.PositionY >= 0 && gameMovement.PositionY < m_map.Height)
     {
         if (!m_gameMovements.Any(m => m.IsSamePosition(gameMovement)))
         {
             m_gameMovements.Add(gameMovement);
             return(gameMovement);
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
 public bool SimulateOneRound()
 {
     if (!IsSimulationOn)
     {
         return(false);
     }
     m_map.ProcessOtherMovements();
     if (m_gameMovements.Any())
     {
         GameMovement gameMovement = m_gameMovements.First();
         m_gameMovements.Remove(gameMovement);
         ProcessPlayerMovement(gameMovement.Direction);
         return(true);
     }
     if (!(m_map.IsWinning || m_map.IsLosing))
     {
         GameMessage = "You lost, because no more moves!";
     }
     IsSimulationOn = false;
     return(false);
 }