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; } }
public Rover(Point point, Char direction, IStateFactory stateFactory, Planet planet) { currentPoint = point; state = stateFactory.BuildState(this, direction, planet); }
public MarsRover(Planet planet, String initialPosition, Char initialDirection, IStateFactory stateFactory) { rover = new Rover(new Point(initialPosition), initialDirection, stateFactory, planet); }
public Rover(Point point, Char direction, Planet planet) { currentPoint = new Vector(point.X, point.Y); currentDirection = InitializeDirection(direction); this.planet = planet; }