Esempio n. 1
0
        bool isGrounded(CharacterControl control)
        {
            if (control.RIGIBODY.velocity.y > -0.001 && control.RIGIBODY.velocity.y <= 0f)
            {
                return(true);
            }

            if (control.RIGIBODY.velocity.y < 0f)
            {
                foreach (GameObject o in control.BottomSpheres)
                {
                    Debug.DrawRay(o.transform.position, -Vector3.up * 0.7f, Color.green);
                    RaycastHit hit;

                    if (Physics.Raycast(o.transform.position, -Vector3.up, out hit, Distance))
                    {
                        if (!control.RagdollParts.Contains(hit.collider) &&
                            !Ledge.isLedge(hit.collider.gameObject) &&
                            !Ledge.isLedgeChecker(hit.collider.gameObject) &&
                            !Ledge.isCharacter(hit.collider.gameObject))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Esempio n. 2
0
 private void OnTriggerExit(Collider col)
 {
     Checkledge = col.gameObject.GetComponent <Ledge>();
     if (Checkledge != null)
     {
         isGrabbingLedge = false;
         // GrabbedLedge = null;
     }
 }
Esempio n. 3
0
 private void OnTriggerEnter(Collider col)
 {
     Checkledge = col.gameObject.GetComponent <Ledge>();
     if (Checkledge != null)
     {
         isGrabbingLedge = true;
         GrabbedLedge    = Checkledge;
     }
 }
Esempio n. 4
0
        bool CheckFront(CharacterControl control)
        {
            foreach (GameObject o in control.FrontSpheres)
            {
                Debug.DrawRay(o.transform.position, control.transform.forward * 0.3f, Color.red);
                RaycastHit hit;

                if (Physics.Raycast(o.transform.position, control.transform.forward, out hit, BlockDistance))
                {
                    if (!control.RagdollParts.Contains(hit.collider))
                    {
                        if (!isBodyPart(hit.collider) &&
                            !Ledge.isLedge(hit.collider.gameObject) &&
                            !Ledge.isLedgeChecker(hit.collider.gameObject))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }