Ejemplo n.º 1
0
 private void Update()
 {
     if (this._climb.gameObject.activeSelf)
     {
         this._sheen.SetActive(false);
         this._sheen.transform.parent = base.transform;
     }
     else if (this._canMove)
     {
         RaycastHit raycastHit;
         if (Physics.Raycast(LocalPlayer.MainCamTr.position, LocalPlayer.MainCamTr.forward, out raycastHit, 6f, this._layerMask))
         {
             bool         flag      = false;
             notClimbable component = raycastHit.transform.gameObject.GetComponent <notClimbable>();
             if (component)
             {
                 flag = true;
             }
             if (!flag)
             {
                 this._canMove = false;
                 this._sheen.transform.parent = null;
                 this._sheen.SetActive(true);
                 Vector3 vector = raycastHit.point;
                 vector   += LocalPlayer.MainCamTr.forward * -1.5f;
                 vector.y -= 1f;
                 this._sheen.transform.position = Vector3.Lerp(this._sheen.transform.position, vector, Time.deltaTime * 20f);
             }
             else
             {
                 this._sheen.SetActive(false);
                 this._sheen.transform.parent = base.transform;
             }
         }
         else
         {
             this._sheen.SetActive(false);
             this._sheen.transform.parent = base.transform;
         }
     }
 }
Ejemplo n.º 2
0
    private IEnumerator scanForCliff()
    {
        yield return(YieldPresets.WaitForEndOfFrame);

        if (!this.cliffAction)
        {
            this.cliffAction = LocalPlayer.SpecialActions.GetComponent <PlayerClimbCliffAction>();
        }
        while (true && base.gameObject != null)
        {
            if (Physics.Raycast(LocalPlayer.MainCamTr.position, LocalPlayer.MainCamTr.forward, out this.hit, 5f, this.layerMask) && !LocalPlayer.FpCharacter.Sitting)
            {
                notClimbable component = this.hit.transform.GetComponent <notClimbable>();
                if (!component)
                {
                    if (!this.hit.collider.gameObject.CompareTag("climbWall") && LocalPlayer.IsInCaves)
                    {
                        this.allowClimb = false;
                        this.MyPickUp.SetActive(false);
                        this.MyPickUp.transform.parent = base.transform;
                    }
                    else if (this.hit.collider.gameObject.layer == 13)
                    {
                        this.MyPickUp.transform.parent = null;
                        if (this.cliffAction.doingClimb)
                        {
                            this.MyPickUp.SetActive(false);
                        }
                        else
                        {
                            this.MyPickUp.SetActive(true);
                        }
                        Vector3 vector = this.hit.point;
                        vector   += LocalPlayer.MainCamTr.forward * -1.5f;
                        vector.y -= 1f;
                        this.MyPickUp.transform.position = Vector3.Lerp(this.MyPickUp.transform.position, vector, Time.deltaTime * 20f);
                        this.allowClimb = true;
                    }
                }
            }
            else
            {
                this.allowClimb = false;
                this.MyPickUp.SetActive(false);
                this.MyPickUp.transform.parent = base.transform;
            }
            if (!this.activateCoolDown)
            {
                if (TheForest.Utils.Input.GetButtonDown("Take") && this.allowClimb && !LocalPlayer.Animator.GetBool("deathBool") && !LocalPlayer.AnimControl.cliffClimb)
                {
                    if (!this.cliffAction.doingClimb && LocalPlayer.Inventory.HasInSlot(Item.EquipmentSlot.RightHand, this._itemId))
                    {
                        LocalPlayer.SpecialActions.SendMessage("setEnterClimbPos", this.hit.point);
                        LocalPlayer.SpecialActions.SendMessage("enterClimbCliff", base.transform);
                        LocalPlayer.AnimControl.cliffEnterNormal = this.hit.normal;
                        LocalPlayer.AnimControl.cliffEnterPos    = this.hit.point;
                        this.activateCoolDown = true;
                        base.Invoke("resetCoolDown", 2.2f);
                    }
                }
                else if (TheForest.Utils.Input.GetButtonDown("Take") && LocalPlayer.AnimControl.allowCliffReset)
                {
                    if (!this.cliffAction)
                    {
                        this.cliffAction = LocalPlayer.SpecialActions.GetComponent <PlayerClimbCliffAction>();
                    }
                    if (this.cliffAction.doingClimb)
                    {
                        LocalPlayer.SpecialActions.SendMessage("exitClimbCliffGround");
                    }
                }
            }
            if (LocalPlayer.Animator.GetBool("deathBool"))
            {
                if (!this.cliffAction)
                {
                    this.cliffAction = LocalPlayer.SpecialActions.GetComponent <PlayerClimbCliffAction>();
                }
                if (this.cliffAction.doingClimb)
                {
                    LocalPlayer.SpecialActions.SendMessage("exitClimbCliffGround");
                }
                base.StopAllCoroutines();
            }
            yield return(YieldPresets.WaitForFixedUpdate);
        }
        yield break;
    }