Пример #1
0
        private void enterClimbRope(Transform trn)
        {
            FsmBool fsmBool = this._player.PM.FsmVariables.GetFsmBool("climbBool");

            if (!fsmBool.Value && !this.doingClimb && !LocalPlayer.FpCharacter.Sitting)
            {
                LocalPlayer.AnimControl.enteringACave = true;
                if (ForestVR.Enabled)
                {
                    LocalPlayer.vrPlayerControl.useGhostMode = true;
                    LocalPlayer.vrPlayerControl.gameObject.SendMessage("useSteppedGhostMode");
                }
                LocalPlayer.CamFollowHead.stopAllCameraShake();
                LocalPlayer.Animator.SetBoolReflected("resetClimbBool", false);
                LocalPlayer.Animator.SetIntegerReflected("climbTypeInt", 0);
                LocalPlayer.MainRotator.enabled      = false;
                LocalPlayer.CamRotator.enabled       = true;
                LocalPlayer.CamRotator.rotationRange = new Vector2(78f, 105f);
                LocalPlayer.AnimControl.lockGravity  = true;
                Vector3 vector = trn.position - trn.forward * this.ropeAttachOffset;
                if (!LocalPlayer.IsInCaves && !Scene.IsInSinkhole(LocalPlayer.Transform.position))
                {
                    float num = Terrain.activeTerrain.SampleHeight(trn.position);
                    if (vector.y < num + 2.75f)
                    {
                        vector.y = Mathf.Max(vector.y, num + 2.75f);
                    }
                }
                this._player.PM.FsmVariables.GetFsmVector3("attachPos").Value = vector;
                if (LocalPlayer.Transform.position.y + 2.5f < vector.y)
                {
                    LocalPlayer.Transform.position = vector;
                }
                activateClimb componentInChildren = trn.parent.GetComponentInChildren <activateClimb>();
                if (componentInChildren)
                {
                    this._bottomTriggerTr = componentInChildren.transform;
                }
                this._player.transform.position = vector;
                this._player.transform.rotation = trn.rotation;
                LocalPlayer.AnimControl.enterClimbMode();
                this._player.HideRightHand(false);
                this._player.PM.FsmVariables.GetFsmGameObject("climbGo").Value = trn.gameObject;
                LocalPlayer.Animator.SetBoolReflected("exitClimbTopBool", false);
                this._player.PM.SendEvent("toClimb");
                fsmBool.Value    = true;
                this.doingClimb  = true;
                this._enteredTop = false;
                base.StartCoroutine("stickToRope", trn);
                this._currentRopeRoot = trn.parent;
            }
        }
Пример #2
0
        private void enterClimbRopeTop(Transform trn)
        {
            FsmBool fsmBool = this._player.PM.FsmVariables.GetFsmBool("climbBool");

            if (!fsmBool.Value && !this.doingClimb && !LocalPlayer.FpCharacter.Sitting)
            {
                LocalPlayer.AnimControl.enteringACave = true;
                base.StartCoroutine(this.blockRopeGroundCheck());
                LocalPlayer.CamFollowHead.stopAllCameraShake();
                LocalPlayer.Animator.SetBoolReflected("resetClimbBool", false);
                fsmBool.Value = true;
                LocalPlayer.MainRotator.enabled        = false;
                LocalPlayer.AnimControl.lockGravity    = true;
                LocalPlayer.MainCamTr.localEulerAngles = new Vector3(0f, 0f, 0f);
                LocalPlayer.CamRotator.enabled         = true;
                LocalPlayer.CamRotator.rotationRange   = new Vector2(78f, 105f);
                activateClimb componentInChildren = trn.parent.GetComponentInChildren <activateClimb>();
                if (componentInChildren)
                {
                    this._bottomTriggerTr = componentInChildren.transform;
                }
                exitClimb componentInChildren2 = trn.parent.GetComponentInChildren <exitClimb>();
                if (componentInChildren2)
                {
                    this._exitTopTrigger = componentInChildren2.GetComponent <Collider>();
                    if (this._exitTopTrigger)
                    {
                        this._exitTopTrigger.enabled = false;
                    }
                }
                Vector3 vector = trn.position + trn.forward * this.ropeAttachTopOffsetZ;
                vector  += trn.right * this.ropeAttachTopOffsetX;
                vector.y = componentInChildren2.transform.position.y - this.ropeAttachTopOffsetY;
                if (LocalPlayer.Inventory.Logs.HasLogs)
                {
                    LocalPlayer.Inventory.Logs.PutDown(false, true, false, null);
                    if (LocalPlayer.Inventory.Logs.HasLogs)
                    {
                        LocalPlayer.Inventory.Logs.PutDown(false, true, false, null);
                    }
                }
                this._lastClimbDownPos = LocalPlayer.Transform.position.y;
                this._player.PM.FsmVariables.GetFsmVector3("attachPos").Value = vector;
                this._player.transform.position = vector;
                this._player.transform.rotation = trn.rotation;
                LocalPlayer.AnimControl.enterClimbMode();
                this._player.PM.FsmVariables.GetFsmGameObject("climbGo").Value = trn.gameObject;
                LocalPlayer.Animator.SetIntegerReflected("climbTypeInt", 0);
                this._player.PM.FsmVariables.GetFsmBool("climbTopBool").Value = true;
                LocalPlayer.Animator.SetBoolReflected("exitClimbTopBool", false);
                this._player.MemorizeItem(Item.EquipmentSlot.RightHand);
                this._player.StashEquipedWeapon(false);
                this._player.PM.SendEvent("toClimb");
                LocalPlayer.Animator.SetBoolReflected("jumpBool", false);
                this._enteredTop = true;
                base.StartCoroutine("stickToRope", trn);
                if (trn.root.name == "Caves")
                {
                    base.StartCoroutine(this.enableDoingClimbAndDelayCavePropsLoading());
                }
                else
                {
                    base.Invoke("enableDoingClimb", 2.6f);
                }
                this._currentRopeRoot = trn.parent;
            }
        }