Exemplo n.º 1
0
    private void RenderCollision <T>(Type type) where T : Collider
    {
        T[]   colliders = UnityEngine.Object.FindObjectsOfType <T>();
        Color color     = ColliderColor(type);

        AddToRenderList(colliders);

        switch (type)
        {
        case Type.Boxes:
            Box3D.Render(colliderList, color, EdgeAlpha, color, FaceAlpha, IsSet(Flags.NoDepth));
            Box3D.Render(triggerList, triggerColor, EdgeAlpha, triggerColor, FaceAlpha, IsSet(Flags.NoDepth));
            break;

        case Type.Spheres:
            Sphere3D.Render(colliderList, color, EdgeAlpha, color, FaceAlpha, IsSet(Flags.NoDepth));
            Sphere3D.Render(triggerList, triggerColor, EdgeAlpha, triggerColor, FaceAlpha, IsSet(Flags.NoDepth));
            break;

        case Type.Capsules:
            Capsule3D.Render(colliderList, color, EdgeAlpha, color, FaceAlpha, IsSet(Flags.NoDepth));
            Capsule3D.Render(triggerList, triggerColor, EdgeAlpha, triggerColor, FaceAlpha, IsSet(Flags.NoDepth));
            break;

        case Type.Meshes:
            Mesh3D.Render(colliderList, color, EdgeAlpha, color, FaceAlpha, IsSet(Flags.NoDepth));
            Mesh3D.Render(triggerList, triggerColor, EdgeAlpha, triggerColor, FaceAlpha, IsSet(Flags.NoDepth));
            break;

        case Type.Characters:
            Character3D.Render(colliderList, color, EdgeAlpha, color, FaceAlpha, IsSet(Flags.NoDepth));
            Character3D.Render(triggerList, triggerColor, EdgeAlpha, triggerColor, FaceAlpha, IsSet(Flags.NoDepth));
            guiColliderCount[(int)Type.Capsules] += colliderList.Count + triggerList.Count;
            break;
        }

        guiColliderCount[(int)type] += colliderList.Count + triggerList.Count;
    }