Пример #1
0
 private static bool GetPlaceInput()
 {
     if (ForestVR.Enabled)
     {
         return(FirstPersonCharacter.GetDropInput());
     }
     return(TheForest.Utils.Input.GetButtonDown("Craft"));
 }
Пример #2
0
 private void Update()
 {
     if (SteamDSConfig.isDedicatedServer)
     {
         return;
     }
     if ((FirstPersonCharacter.GetDropInput() || (ForestVR.Enabled && TheForest.Utils.Input.GetButtonDown("Fire1") && !LocalPlayer.Inventory.DontShowDrop)) && LocalPlayer.Inventory.CurrentView == PlayerInventory.PlayerViews.World)
     {
         this.PutDown(false, true, true, null);
     }
 }
Пример #3
0
 private void Update()
 {
     if ((LocalPlayer.AnimControl.onRope || LocalPlayer.AnimControl.useRootMotion || LocalPlayer.AnimControl.onRockThrower || LocalPlayer.FpCharacter.drinking || LocalPlayer.AnimControl.holdingGirl) && this.Inventory.CurrentView == PlayerInventory.PlayerViews.Book)
     {
         this.ShouldOpenBook = false;
         this.CloseTheBook(false);
         return;
     }
     if (this.IsClosing)
     {
         if (!PlayerPreferences.CanUpdateFov)
         {
             if (!ForestVR.Enabled)
             {
                 LocalPlayer.MainCam.fieldOfView = Mathf.SmoothDamp(LocalPlayer.MainCam.fieldOfView, PlayerPreferences.Fov, ref this._fovChangeSpeed, 0.15f);
             }
             if (Mathf.Approximately(LocalPlayer.MainCam.fieldOfView, PlayerPreferences.Fov))
             {
                 this.IsClosing = false;
                 PlayerPreferences.CanUpdateFov = true;
             }
         }
     }
     else if (this.Inventory.CurrentView == PlayerInventory.PlayerViews.Book)
     {
         if ((!TheForest.Utils.Input.IsGamePad) ? TheForest.Utils.Input.GetButtonDown("Esc") : TheForest.Utils.Input.GetButtonDown("Back"))
         {
             this.CloseTheBook(false);
         }
         if (!PlayerPreferences.CanUpdateFov && !Mathf.Approximately(LocalPlayer.MainCam.fieldOfView, 65f) && !ForestVR.Enabled)
         {
             LocalPlayer.MainCam.fieldOfView = Mathf.SmoothDamp(LocalPlayer.MainCam.fieldOfView, 70f, ref this._fovChangeSpeed, 0.15f);
         }
         VirtualCursor.Instance.SetCursorType((!TheForest.Utils.Input.IsGamePad) ? VirtualCursor.CursorTypes.Arrow : VirtualCursor.CursorTypes.None);
     }
     if (this.ShouldOpenBook)
     {
         this.OpenBook();
     }
     if (this.LockPlace)
     {
         this.LockPlace = false;
     }
     else if (this.CreateMode)
     {
         if (!this.ShownPlace)
         {
             this.Grabber.ShowPlace();
             this.ShownPlace = true;
         }
         bool button = TheForest.Utils.Input.GetButton("Batch");
         if (Scene.HudGui.BatchPlaceIcon.activeSelf != button)
         {
             Scene.HudGui.BatchPlaceIcon.SetActive(button);
         }
         if ((!TheForest.Utils.Input.IsGamePad) ? TheForest.Utils.Input.GetButtonDown("Esc") : FirstPersonCharacter.GetDropInput())
         {
             this.CancelPlace();
         }
         else if (this._buildingPlacer.Clear && TheForest.Utils.Input.GetButtonDown("Build"))
         {
             this.PlaceGhost(button);
         }
     }
 }
Пример #4
0
        public IEnumerator pickupGirlRoutine(Vector3 pos)
        {
            this.enablePlayerLocked();
            LocalPlayer.Animator.SetBool("girlPickup", true);
            this.girlGo.transform.position = LocalPlayer.PlayerBase.transform.position;
            this.girlGo.transform.rotation = LocalPlayer.PlayerBase.transform.rotation;
            float timer = 0f;

            this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
            while (this.currState2.shortNameHash != this.idleToGirlHash)
            {
                this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                LocalPlayer.Rigidbody.velocity = Vector3.zero;
                this.girlGo.transform.position = LocalPlayer.PlayerBase.transform.position;
                this.girlGo.transform.rotation = LocalPlayer.PlayerBase.transform.rotation;
                if (this.currState2.shortNameHash == this.idleToGirlHash)
                {
                    break;
                }
                yield return(null);
            }
            Animator girlAnimator = this.girlGo.GetComponentInChildren <Animator>();

            girlAnimator.enabled = true;
            if (BoltNetwork.isRunning)
            {
                syncGirlPickup syncGirlPickup = syncGirlPickup.Create(GlobalTargets.Others);
                syncGirlPickup.playerTarget        = base.transform.root.GetComponent <BoltEntity>();
                syncGirlPickup.target              = this.girlGo.GetComponent <BoltEntity>();
                syncGirlPickup.syncPickupAnimation = true;
                syncGirlPickup.Send();
            }
            while (this.currState2.shortNameHash == this.idleToGirlHash)
            {
                LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                girlAnimator.Play("Base Layer.girlPickup", 0, this.currState2.normalizedTime);
                yield return(null);
            }
            girlAnimator.CrossFade("Base Layer.girlPickup", 0f, 0, 1f);
            if (this.girlGo)
            {
                this.girlHeld.SetActive(true);
                this.girlHeld.transform.parent = LocalPlayer.ScriptSetup.spine3.transform;
                if (!BoltNetwork.isRunning || this.girlGo.GetComponent <BoltEntity>().isOwner)
                {
                    UnityEngine.Object.Destroy(this.girlGo);
                }
                else
                {
                    syncGirlPickup syncGirlPickup2 = syncGirlPickup.Create(GlobalTargets.Others);
                    syncGirlPickup2.target        = this.girlGo.GetComponent <BoltEntity>();
                    syncGirlPickup2.destroyPickup = true;
                    syncGirlPickup2.Send();
                    this.girlGo = null;
                }
                this.disablePlayerLocked();
                timer = 0f;
                while (timer < 1f)
                {
                    LocalPlayer.CamFollowHead.transform.localRotation = Quaternion.Lerp(LocalPlayer.CamFollowHead.transform.localRotation, LocalPlayer.CamFollowHead.transform.parent.localRotation, timer);
                    timer += Time.deltaTime * 3f;
                    yield return(null);
                }
                while (this.currState2.shortNameHash == this.girlIdleHash)
                {
                    LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                    this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                    LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.RightHand);
                    LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.LeftHand);
                    if (FirstPersonCharacter.GetDropInput() || (ForestVR.Enabled && TheForest.Utils.Input.GetButtonDown("Fire1")))
                    {
                        if (LocalPlayer.Animator.GetCurrentAnimatorStateInfo(0).tagHash == this.idleHash && !LocalPlayer.AnimControl.onRope && !LocalPlayer.AnimControl.onRaft && LocalPlayer.FpCharacter.Grounded && LocalPlayer.Inventory.CurrentView != PlayerInventory.PlayerViews.Book && LocalPlayer.Inventory.CurrentView != PlayerInventory.PlayerViews.Inventory)
                        {
                            base.StartCoroutine(this.putDownGirlRoutine());
                            yield break;
                        }
                        yield return(null);
                    }
                    yield return(null);
                }
            }
            else
            {
                LocalPlayer.Animator.SetBool("girlPickup", false);
                this.disablePlayerLocked();
                LocalPlayer.AnimControl.holdingGirl = false;
                LocalPlayer.Inventory.EquipPreviousWeapon(true);
                LocalPlayer.Inventory.ShowAllEquiped(true);
            }
            yield break;
        }