public override void OnEnter() { DWaypoint waypoint = new DWaypoint(WaypointName, WaypointObject.Value, WaypointZone, ShowOnscreenIndicator, OnscreenIndicatorOffset.Value); Service.Get <ZonePathing>().SetWaypoint(waypoint); Finish(); }
public void SetWaypoint(DWaypoint waypointData) { currentWaypointData = waypointData; GameObject gameObject = string.IsNullOrEmpty(waypointData.WaypointName) ? waypointData.WaypointObject : GameObject.Find(waypointData.WaypointName.Trim()); CustomZonePathingTrigger[] array = Object.FindObjectsOfType <CustomZonePathingTrigger>(); for (int i = 0; i < array.Length; i++) { if (array[i].IsInTrigger && array[i].IsOverrideActive()) { if (gameObject == null) { gameObject = array[i].OverrideWaypointTarget.gameObject; break; } CustomZonePathingTarget component = gameObject.GetComponent <CustomZonePathingTarget>(); if (component == null || component.IsCustomWaypointActive()) { gameObject = array[i].OverrideWaypointTarget.gameObject; break; } } } EventDispatcher eventDispatcher = Service.Get <EventDispatcher>(); bool flag = true; Vector3 onScreenIndicatorOffset = waypointData.OnScreenIndicatorOffset; if (gameObject != null) { flag = false; CustomZonePathingTarget component = gameObject.GetComponent <CustomZonePathingTarget>(); if (component != null && component.IsCustomWaypointActive()) { gameObject = component.WaypointPosition; } eventDispatcher.DispatchEvent(new HudEvents.SetNavigationTarget(gameObject.transform, waypointData.ShowOnScreenIndicator, onScreenIndicatorOffset)); } else if (waypointData.WaypointZone != null) { ZoneDefinition currentZone = Service.Get <ZoneTransitionService>().CurrentZone; string nextZoneInPath = GetNextZoneInPath(currentZone.ZoneName, waypointData.WaypointZone); GameObject gameObject2 = GameObject.Find(nextZoneInPath + "Transition"); if (gameObject2 != null) { flag = false; eventDispatcher.DispatchEvent(new HudEvents.SetNavigationTarget(gameObject2.transform)); } } if (flag) { eventDispatcher.DispatchEvent(default(HudEvents.SetNavigationTarget)); } }
public void ClearWaypoint() { Service.Get <EventDispatcher>().DispatchEvent(default(HudEvents.SetNavigationTarget)); currentWaypointData = null; }