void UpdateTaskMode() { if (parent.localWorldMap == null) { return; } switch (mode) { case TaskDestinationMode.Stop: if (parent.localWorldMap.DestinationLocation != null) { mode = TaskDestinationMode.Destination; UpdateAndLaunch(parent.localWorldMap.DestinationLocation); } else if (parent.localWorldMap.WaypointLocations.Count >= 1) { mode = TaskDestinationMode.Waypoint; PointD point = parent.localWorldMap.WaypointLocations[0]; UpdateAndLaunch(new Location(point.X, point.Y, 0, 0, 0, 0)); } else { state = TaskDestinationState.Arret; } break; case TaskDestinationMode.Waypoint: if (parent.localWorldMap.DestinationLocation != null) { mode = TaskDestinationMode.Destination; } state = TaskDestinationState.Avance; break; case TaskDestinationMode.Destination: state = TaskDestinationState.Avance; break; default: break; } }
public void TaskReached() { switch (mode) { case TaskDestinationMode.Destination: parent.OnDestinationReached(parent.localWorldMap.DestinationLocation); break; case TaskDestinationMode.Waypoint: parent.OnWaypointsReached(parent.localWorldMap.WaypointLocations[0]); Random rand = new Random(); parent.OnSetNewWaypoint(new PointD((rand.NextDouble() - 0.5) * 2.6, (rand.NextDouble() - 0.5) * 1.8)); /// Only for fun break; default: break; } mode = TaskDestinationMode.Stop; }