Beispiel #1
0
        public static bool TeleportToGlobalMapPoint(BlueprintGlobalMapPoint destination)
        {
            if (GlobalMapView.Instance != null)
            {
                var            globalMapController = Game.Instance.GlobalMapController;
                GlobalMapUI    globalMapUI         = Game.Instance.UI.GlobalMapUI;
                GlobalMapView  globalMapView       = GlobalMapView.Instance;
                GlobalMapState globalMapState      = Game.Instance.Player.GetGlobalMap(destination.GlobalMap);

                GlobalMapPointState pointState = Game.Instance.Player.GetGlobalMap(destination.GlobalMap).GetPointState(destination);
                pointState.EdgesOpened = true;
                pointState.Reveal();
                GlobalMapPointView pointView = globalMapView.GetPointView(destination);
                if ((bool)(UnityEngine.Object)globalMapView)
                {
                    if ((bool)(UnityEngine.Object)pointView)
                    {
                        globalMapView.RevealLocation(pointView);
                    }
                }
                foreach (var edge in pointState.Edges)
                {
                    edge.UpdateExplored(1f, 1);
                    globalMapView.GetEdgeView(edge.Blueprint).UpdateRenderers();
                }
                globalMapController.StartTravels();
                EventBus.RaiseEvent <IGlobalMapPlayerTravelHandler>((Action <IGlobalMapPlayerTravelHandler>)(h => h.HandleGlobalMapPlayerTravelStarted((IGlobalMapTraveler)globalMapView.State.Player)));
                globalMapView.State.Player.SetCurrentPosition(new GlobalMapPosition(destination));
                globalMapView.GetPointView(destination)?.OpenOutgoingEdges((GlobalMapPointView)null);
                globalMapView.UpdatePawnPosition();
                globalMapController.Stop();
                EventBus.RaiseEvent <IGlobalMapPlayerTravelHandler>((Action <IGlobalMapPlayerTravelHandler>)(h => h.HandleGlobalMapPlayerTravelStopped((IGlobalMapTraveler)globalMapView.State.Player)));
                globalMapView.PlayerPawn.m_Compass.TryClear();
                globalMapView.PlayerPawn.m_Compass.TrySet();
#if false
                globalMapView.TeleportParty(globalMapPoint);
                globalMapUI.HandleGlobalMapPlayerTravelStopped(globalMapState.Player);
                GlobalMapPointState pointState = Game.Instance.Player.GlobalMap.GetPointState(globalMapPoint);
                pointState.EdgesOpened = true;
                pointState.Reveal();
                GlobalMapPointView pointView = globalMapView.GetPointView(globalMapPoint);
                pointView?.OpenOutgoingEdges((GlobalMapPointView)null);
                globalMapView.RevealLocation(pointView);
                if ((bool)(UnityEngine.Object)globalMapView)
                {
                    if ((bool)(UnityEngine.Object)pointView)
                    {
                        globalMapView.RevealLocation(pointView);
                    }
                }
                globalMapView.UpdatePawnPosition();
                pointState.LastVisited = Game.Instance.TimeController.GameTime;
#endif
                return(true);
            }
            return(false);
        }
Beispiel #2
0
 public static void To(this BlueprintGlobalMapPoint globalMapPoint)
 {
     Game.Instance.LoadArea(globalMapPoint.GlobalMap.GlobalMapEnterPoint, AutoSaveMode.None, () => {
         TeleportToGlobalMapPoint(globalMapPoint);
     });
     //if (!Teleport.TeleportToGlobalMapPoint(globalMapPoint)) {
     //    Teleport.TeleportToGlobalMap(() => Teleport.TeleportToGlobalMapPoint(globalMapPoint));
     //}
 }