Ejemplo n.º 1
0
 public State BuildState(Rover rover, char direction, Planet planet)
 {
     switch (direction)
     {
         case north:
             return new FacingNorth(rover, planet);
         case south:
             return new FacingSouth(rover, planet);
         case east:
             return new FacingEast(rover, planet);
         case west:
             return new FacingWest(rover, planet);
         default:
             return null;
     }
 }
Ejemplo n.º 2
0
 public Rover(Point point, Char direction, IStateFactory stateFactory, Planet planet)
 {
     currentPoint = point;
     state = stateFactory.BuildState(this, direction, planet);
 }
Ejemplo n.º 3
0
 public MarsRover(Planet planet, String initialPosition, Char initialDirection, IStateFactory stateFactory)
 {
     rover = new Rover(new Point(initialPosition), initialDirection, stateFactory, planet);
 }
Ejemplo n.º 4
0
 public Rover(Point point, Char direction, Planet planet)
 {
     currentPoint = new Vector(point.X, point.Y);
     currentDirection = InitializeDirection(direction);
     this.planet = planet;
 }