예제 #1
0
        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));
            }
        }
예제 #2
0
 public void ClearWaypoint()
 {
     Service.Get <EventDispatcher>().DispatchEvent(default(HudEvents.SetNavigationTarget));
     currentWaypointData = null;
 }