Ejemplo n.º 1
0
 bool CheckFront(CharacterControl control)
 {
     foreach (GameObject o in control.FrontSpheres)
     {
         Debug.DrawRay(o.transform.position, control.transform.forward * BlockDistance, Color.yellow);
         RaycastHit hit;
         if (Physics.Raycast(o.transform.position, control.transform.forward, out hit, BlockDistance))
         {
             if (!control.RagdollParts.Contains(hit.collider))
             {
                 if (!IsBodyPart(hit.collider) && !Edge.IsEdge(hit.collider.gameObject) && !Edge.IsEdgeChecker(hit.collider.gameObject))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
        bool IsGrounded(CharacterControl control)
        {
            if (control.RIGID_BODY.velocity.y >= -0.001f && control.RIGID_BODY.velocity.y <= 0f)
            {
                return(true);
            }

            if (control.RIGID_BODY.velocity.y < 0f)
            {
                foreach (GameObject o in control.BottomSpheres)
                {
                    Debug.DrawRay(o.transform.position, -Vector3.up * Distance, Color.yellow);
                    RaycastHit hit;
                    if (Physics.Raycast(o.transform.position, -Vector3.up, out hit, Distance))
                    {
                        if (!control.RagdollParts.Contains(hit.collider) && !Edge.IsEdge(hit.collider.gameObject) && !Edge.IsEdgeChecker(hit.collider.gameObject))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }