public Location GetNewLocation(ObstacleBehaviourRequest request)
        {
            if (request.RobotCurrentLocation == null)
            {
                throw new ObstacleBehaviourException("Robot current location is not known");
            }
            if (request.RobotCurrentLocation.Coordinate == null)
            {
                throw new ObstacleBehaviourException("Robot current coordinates are not known");
            }
            if (request.RobotCurrentLocation.DirectionFace == null)
            {
                throw new ObstacleBehaviourException("Robot current direction is not known");
            }
            Direction newDirection;
            var       currentdegree = (int)request.RobotCurrentLocation.DirectionFace.Value;

            currentdegree += 90;

            if (currentdegree == 360)
            {
                newDirection = Direction.East;
            }
            else
            {
                newDirection = (Direction)currentdegree;
            }

            return(new Location(request.RobotCurrentLocation.Coordinate, newDirection));
        }
 public Location GetNewLocation(ObstacleBehaviourRequest request)
 {
     if (request.RobotInitialLocation == null)
     {
         throw new ObstacleBehaviourException("Robot Initial Location is not found");
     }
     return(request.RobotInitialLocation);
 }
示例#3
0
 public Location GetNewLocation(ObstacleBehaviourRequest request)
 {
     throw new ObstacleBehaviourException("Cannot move to this location");
 }