示例#1
0
        protected void WaitForNextChoice()
        {
            mNextChoiceWaitStartTime = WorldClock.AdjustedRealTime;
            AvailablePathMarkers.Clear();
            Paths.GetAllNeighbors(LastChosenPathMarker, DesiredLocationTypes, AvailablePathMarkers);
            //see if the player is holding down the forward key - if they are, keep moving
            bool             canSkipNextJunction = AvailablePathMarkers.Count > 1;
            Vector3          currentDirection    = Player.Local.ForwardVector;
            FastTravelChoice bestChoiceSoFar     = AvailablePathMarkers[0];

            if ((Mathf.Abs(UserActionManager.RawMovementAxisX) > MovementThreshold || Math.Abs(UserActionManager.RawMovementAxisY) > MovementThreshold) && canSkipNextJunction)
            {
                Debug.Log("Skipping junction");
                if (AvailablePathMarkers.Count == 2)
                {
                    //choose the one opposite us
                    if (bestChoiceSoFar.ConnectingPath == LastChosenPath)
                    {
                        bestChoiceSoFar = AvailablePathMarkers[1];
                    }
                }
                else
                {
                    float smallestDotSoFar = Mathf.Infinity;
                    foreach (FastTravelChoice choice in AvailablePathMarkers)
                    {
                        Vector3 nextDirection = choice.StartMarker.Position - choice.FirstInDirection.Position;
                        float   dot           = Vector3.Dot(currentDirection.normalized, nextDirection.normalized);
                        if (dot < smallestDotSoFar)
                        {
                            smallestDotSoFar = dot;
                            bestChoiceSoFar  = choice;
                        }
                    }
                }
                MakeChoice(bestChoiceSoFar);
            }
            else
            {
                if (Player.Local.IsHijacked)
                {
                    //let the player walk around again
                    mTerrainHit.feetPosition     = CurrentPosition;
                    mTerrainHit.overhangHeight   = 2f;
                    mTerrainHit.groundedHeight   = 3f;
                    mTerrainHit.ignoreWorldItems = true;
                    CurrentPosition.y            = GameWorld.Get.TerrainHeightAtInGamePosition(ref mTerrainHit) + 0.0125f;                                                 //just in case, pad it out
                    Player.Local.Position        = CurrentPosition;
                    Debug.Log(CurrentPosition.y.ToString());
                    Player.Local.RestoreControl(true);
                }
                Player.Local.Projections.ShowFastTravelChoices(LastChosenPathMarker, AvailablePathMarkers);
                FastTravelInterface.Maximize();
                State = FastTravelState.WaitingForNextChoice;
            }
        }
示例#2
0
        public void MakeChoice(FastTravelChoice choice)
        {
            Player.Local.HijackControl();
            Player.Local.HijackLookSpeed = 0.05f;

            CurrentChoice = choice;
            //convert the current choice's indexes & whatnot into start / end spline params
            LastChosenPath = choice.ConnectingPath;
            Paths.SetActivePath(LastChosenPath, GameWorld.Get.PrimaryChunk);
            CurrentPosition    = Player.Local.Position;
            CurrentOrientation = Player.Local.Rotation.eulerAngles;
            PathEndMeters      = Paths.ActivePath.MetersFromPosition(CurrentChoice.EndMarker.Position);
            PathStartMeters    = Paths.ActivePath.MetersFromPosition(CurrentChoice.StartMarker.Position);
            PathCurrentMeters  = PathStartMeters;
            //go!
            State = FastTravelState.Traveling;
            //enabled = true;
            MasterAudio.PlaySound(MasterAudio.SoundType.PlayerInterface, "FastTravelMakeChoice");
        }
示例#3
0
        protected void OnFinishTraveling()
        {
            //Debug.Log("Finished traveling");
            Player.Local.Projections.ClearDirectionalArrows();
            State = FastTravelState.None;
            Player.Get.AvatarActions.ReceiveAction((AvatarAction.FastTravelStop), WorldClock.AdjustedRealTime);
            FastTravelInterface.Minimize();
            CurrentChoice = null;

            if (Player.Local.IsHijacked)
            {
                mTerrainHit.feetPosition = CurrentPosition;
                CurrentPosition.y        = GameWorld.Get.TerrainHeightAtInGamePosition(ref mTerrainHit) + 0.05f;                                         //just in case, pad it out
                //WorldClock.Get.SetTargetSpeed (1.0f);
                Player.Local.HijackedPosition.position = CurrentPosition + Player.Local.Height;
                Player.Local.Position = CurrentPosition;
                Player.Local.RestoreControl(true);
            }
        }
示例#4
0
 protected void ArriveAtDestination()
 {
     LastChosenPathMarker = CurrentChoice.EndMarker;
     CurrentChoice        = null;
     State = FastTravelState.ArrivingAtDestination;
 }
示例#5
0
 public void ConsiderChoice(FastTravelChoice choice)
 {
     //TODO show the path name or something
 }