예제 #1
0
 public void UpdateXCoordinate(Direction direction)
 {
     if (direction.GetCurrentDirection() == 'E')
     {
         _xCoordinate++;
     }
     else if (direction.GetCurrentDirection() == 'W')
     {
         _xCoordinate--;
     }
 }
예제 #2
0
 public void UpdateYCoordinate(Direction direction)
 {
     if (direction.GetCurrentDirection() == 'N')
     {
         _yCoordinate++;
     }
     else if (direction.GetCurrentDirection() == 'S')
     {
         _yCoordinate--;
     }
 }
예제 #3
0
        public void UpdateCoordinatePosition()
        {
            switch (direction.GetCurrentDirection())
            {
            case 'N':
                coordinates.UpdateYCoordinate(direction);
                break;

            case 'S':
                coordinates.UpdateYCoordinate(direction);
                break;

            case 'E':
                coordinates.UpdateXCoordinate(direction);
                break;

            case 'W':
                coordinates.UpdateXCoordinate(direction);
                break;
            }
        }