void IHandleMessage <UnitNavigationEventMessage> .Handle(UnitNavigationEventMessage message) { if (message.isHandled) { return; } switch (message.eventCode) { case UnitNavigationEventMessage.Event.WaypointReached: case UnitNavigationEventMessage.Event.DestinationReached: { message.isHandled = PatrolMaster.Continue(message.entity); break; } case UnitNavigationEventMessage.Event.StoppedNoRouteExists: case UnitNavigationEventMessage.Event.StoppedDestinationBlocked: case UnitNavigationEventMessage.Event.Stuck: { message.isHandled = PatrolMaster.Stop(message.entity); break; } } }
void IHandleMessage <UnitNavigationEventMessage> .Handle(UnitNavigationEventMessage message) { if (message.isHandled) { return; } switch (message.eventCode) { case UnitNavigationEventMessage.Event.WaypointReached: case UnitNavigationEventMessage.Event.DestinationReached: { message.isHandled = true; PatrolMaster.Continue(message.entity); break; } case UnitNavigationEventMessage.Event.Stuck: { message.isHandled = true; //PatrolMaster.Start(message.entity); break; } } }
internal void Continue() { if (_stopped) { return; } else if (!this.unit.isAlive) { PatrolMaster.StopPatrol(this.unit); return; } _currentIndex = _nextIndex; IncrementNext(); if (this.lingerForSeconds == 0f) { this.unit.MoveTo(route[_nextIndex], true); } else { this.unit.MoveTo(route[_currentIndex], false); } }