calBoxRelations() static private method

static private calBoxRelations ( BoxCollider box, Vector3 point, bool containedToBox, bool &isPointInBox ) : Vector3
box BoxCollider
point Vector3
containedToBox bool
isPointInBox bool
return Vector3
    private static Vector3 getClosestPointOnSurfaceBox(BoxCollider box, Vector3 point)
    {
        bool    flag;
        Vector3 vector = Moba_Camera_Boundaries.calBoxRelations(box, point, true, out flag);

        return(box.transform.position + box.transform.forward * vector.z + box.transform.right * vector.x + box.transform.up * vector.y);
    }
Beispiel #2
0
    public static bool isPointInBoundary(Vector3 point)
    {
        bool result = false;

        foreach (Moba_Camera_Boundary current in Moba_Camera_Boundaries.cube_boundaries)
        {
            if (current.isActive)
            {
                BoxCollider component = current.GetComponent <BoxCollider>();
                if (component == null)
                {
                    Debug.LogWarning("Boundary: " + current.name + "; Error: BoundaryType and Collider mismatch.");
                }
                else
                {
                    bool flag;
                    Moba_Camera_Boundaries.calBoxRelations(component, point, false, out flag);
                    if (flag)
                    {
                        result = true;
                    }
                }
            }
        }
        foreach (Moba_Camera_Boundary current2 in Moba_Camera_Boundaries.sphere_boundaries)
        {
            if (current2.isActive)
            {
                SphereCollider component2 = current2.GetComponent <SphereCollider>();
                if (component2 == null)
                {
                    Debug.LogWarning("Boundary: " + current2.name + "; Error: BoundaryType and Collider mismatch.");
                }
                else if ((current2.transform.position + component2.center - point).magnitude < component2.radius)
                {
                    result = true;
                }
            }
        }
        return(result);
    }
    public static bool isPointInBoundary(Vector3 point)
    {
        bool result = false;

        ListView <Moba_Camera_Boundary> .Enumerator enumerator = Moba_Camera_Boundaries.cube_boundaries.GetEnumerator();
        while (enumerator.MoveNext())
        {
            Moba_Camera_Boundary current = enumerator.get_Current();
            if (current.isActive)
            {
                BoxCollider component = current.GetComponent <BoxCollider>();
                if (!(component == null))
                {
                    bool flag;
                    Moba_Camera_Boundaries.calBoxRelations(component, point, false, out flag);
                    if (flag)
                    {
                        result = true;
                    }
                }
            }
        }
        ListView <Moba_Camera_Boundary> .Enumerator enumerator2 = Moba_Camera_Boundaries.sphere_boundaries.GetEnumerator();
        while (enumerator2.MoveNext())
        {
            Moba_Camera_Boundary current2 = enumerator2.get_Current();
            if (current2.isActive)
            {
                SphereCollider component2 = current2.GetComponent <SphereCollider>();
                if (!(component2 == null))
                {
                    if ((current2.transform.position + component2.center - point).magnitude < component2.radius)
                    {
                        result = true;
                    }
                }
            }
        }
        return(result);
    }