Ejemplo n.º 1
0
 public static bool CheckInsideFOV(
     Vector2 angle,
     Transform transform,
     Transform target,
     float viewDistance)
 {
     return(PhysicsUtility.CheckInsideFOV(angle, transform, target.get_position(), viewDistance));
 }
Ejemplo n.º 2
0
        public static bool CheckFOV(
            LayerMask layer,
            Vector2 angle,
            Transform transform,
            Collider target,
            float viewDistance)
        {
            if (UnityEx.Misc.UnityExtensions.Contains(layer, ((Component)target).get_gameObject().get_layer()))
            {
                return(false);
            }
            Vector3 vector3 = Vector3.get_zero();
            float   num     = 0.0f;

            switch (target)
            {
            case SphereCollider _:
            case CapsuleCollider _:
                switch (target)
                {
                case SphereCollider _:
                    vector3 = (target as SphereCollider).get_center();
                    num     = (target as SphereCollider).get_radius();
                    break;

                case CapsuleCollider _:
                    vector3 = (target as CapsuleCollider).get_center();
                    num     = (target as CapsuleCollider).get_radius();
                    break;
                }
                return(PhysicsUtility.CheckInsideFOV(angle, transform, Vector3.op_Addition(((Component)target).get_transform().get_position(), Quaternion.op_Multiply(((Component)target).get_transform().get_rotation(), vector3)), viewDistance + num));

            default:
                return(false);
            }
        }
Ejemplo n.º 3
0
 public static bool CheckFOVPoint(
     LayerMask layer,
     Vector2 angle,
     Transform transform,
     Transform target,
     float viewDistance)
 {
     return(!UnityEx.Misc.UnityExtensions.Contains(layer, ((Component)target).get_gameObject().get_layer()) && PhysicsUtility.CheckInsideFOV(angle, transform, target, viewDistance));
 }