コード例 #1
0
    static public void DrawPoint(Transform point, Transform teleporter, Color color, bool single = false)
    {
        if (point == null)
        {
            return;
        }
        Handles.color = Color.white;

        if (Handles.Button(point.position, point.rotation, 0.8f, 0.8f, Handles.SphereHandleCap))
        {
            MapDescriptorEditor.moveTo(point);
        }

        Handles.color = color;
        HandleHelpers.DrawArrow(teleporter.position, point.position, 2.0f);
        Handles.color = Color.blue;
        HandleHelpers.DrawArrow(point.position, point.position + point.forward * 1.75f, 1.5f);

        if (single)
        {
            HandleHelpers.Label(point.position + Vector3.up, point.gameObject.name);
        }
        else
        {
            HandleHelpers.ResizeLabel(point.position + Vector3.up, point.gameObject.name);
        }
    }
コード例 #2
0
    public static void DrawRoundEnd(VmodMonkeMapLoader.Behaviours.RoundEndActions roundEndActions, bool single = false)
    {
        Handles.color = (Color.green + Color.black) / 2;

        float size = 10.0f;

        foreach (var point in roundEndActions.ObjectsToEnable)
        {
            if (Handles.Button(point.transform.position, point.transform.rotation, size, size, Handles.SphereHandleCap))
            {
                MapDescriptorEditor.moveTo(point.transform);
            }
            HandleHelpers.Label(point.transform.position + Vector3.up * (size * .5f) + Vector3.up, new GUIContent(point.name), single);
        }

        Handles.color = (Color.red + Color.black) / 2;

        foreach (var point in roundEndActions.ObjectsToDisable)
        {
            if (Handles.Button(point.transform.position, point.transform.rotation, size, size, Handles.SphereHandleCap))
            {
                MapDescriptorEditor.moveTo(point.transform);
            }
            HandleHelpers.Label(point.transform.position + Vector3.up * (size * .5f) + Vector3.up, new GUIContent(point.name), single);
        }
    }
コード例 #3
0
    public static void DrawTagZone(VmodMonkeMapLoader.Behaviours.TagZone zone, bool single = false)
    {
        Handles.color = Color.red;

        if (Handles.Button(zone.transform.position, zone.transform.rotation, 1.0f, 1.0f, Handles.CubeHandleCap))
        {
            MapDescriptorEditor.moveTo(zone.transform);
        }
        HandleHelpers.Label(zone.transform.position + Vector3.up, new GUIContent(zone.gameObject.name));
    }
コード例 #4
0
    static public void DrawTeleport(VmodMonkeMapLoader.Behaviours.Teleporter targetTele, bool single = false)
    {
        Color theColor = Color.green;

        if (targetTele.TagOnTeleport)
        {
            theColor = Color.Lerp(Color.red, Color.yellow, .5f);
        }
        Handles.color = theColor;

        if (targetTele.TeleportPoints == null || targetTele.TeleportPoints.Count == 0)
        {
            Handles.SphereHandleCap(0, targetTele.transform.position, targetTele.transform.rotation, 1.0f, EventType.Repaint);
            if (!single)
            {
                HandleHelpers.ResizeLabel(targetTele.transform.position + Vector3.up, "TreeTeleporter");
            }
        }
        else
        {
            for (int i = 0; i < targetTele.TeleportPoints.Count; i++)
            {
                Transform point = targetTele.TeleportPoints[i];
                if (point == null)
                {
                    targetTele.TeleportPoints.RemoveAt(i);
                    continue;
                }
                DrawPoint(point, targetTele.transform, theColor, single);
            }

            Handles.color = theColor;

            if (!single)
            {
                HandleHelpers.ResizeLabel(targetTele.transform.position + Vector3.up, targetTele.gameObject.name);
                if (Handles.Button(targetTele.transform.position, targetTele.transform.rotation, 1.0f, 1.0f, Handles.SphereHandleCap))
                {
                    MapDescriptorEditor.moveTo(targetTele.transform);
                }
            }
            else
            {
                Handles.SphereHandleCap(0, targetTele.transform.position, targetTele.transform.rotation, 1.0f, EventType.Repaint);
            }
        }

        if (single)
        {
            Vector3    position = targetTele.transform.position + targetTele.transform.forward * 2;
            Quaternion rotation = SceneView.lastActiveSceneView.rotation;
            //Handles.Rectang;

            Handles.BeginGUI();

            Rect vertical = EditorGUILayout.BeginVertical(MapDescriptorConfig.textStyle, GUILayout.Width(MapDescriptorConfig.guiWidth));
            GUILayout.Label(targetTele.gameObject.name, EditorStyles.boldLabel);

            if (GUILayout.Button("Add New Teleport Point"))
            {
                AddPoint(targetTele);
            }

            targetTele.TagOnTeleport = EditorGUILayout.Toggle("Tag on Teleport", targetTele.TagOnTeleport);

            targetTele.TouchType = (VmodMonkeMapLoader.Behaviours.GorillaTouchType)EditorGUILayout.EnumPopup("TouchType", targetTele.TouchType);

            targetTele.Delay = EditorGUILayout.FloatField("Delay", targetTele.Delay);
            EditorGUILayout.EndVertical();
            Handles.EndGUI();
        }
    }
コード例 #5
0
    static public void DrawSurface(VmodMonkeMapLoader.Behaviours.SurfaceClimbSettings surface, bool single = false)
    {
        Handles.color = surface.Unclimbable ? Color.white : (Color.cyan + Color.white) / 2.0f;
        foreach (var collider in surface.gameObject.GetComponents <Collider>())
        {
            if (collider is MeshCollider)
            {
                Vector3[]      verts     = (collider as MeshCollider).sharedMesh.vertices;
                List <Vector3> positions = new List <Vector3>();
                foreach (var vert in verts)
                {
                    if (!positions.Contains(vert))
                    {
                        positions.Add(vert);
                    }
                }

                foreach (var vert in positions)
                {
                    Vector3 temp = new Vector3(vert.x * collider.transform.lossyScale.x, vert.y * collider.transform.lossyScale.y, vert.z * collider.transform.lossyScale.z) + collider.transform.position;
                    if (single)
                    {
                        Handles.SphereHandleCap(0, temp, Quaternion.identity, .5f, EventType.Repaint);
                    }
                    else if (Handles.Button(temp, Quaternion.identity, .5f, .5f, Handles.SphereHandleCap))
                    {
                        MapDescriptorEditor.moveTo(collider.transform);
                    }
                }
            }
            else if (collider is SphereCollider)
            {
                float   size = (collider as SphereCollider).radius * collider.transform.lossyScale.magnitude;
                Vector3 pos  = collider.transform.position;

                if (single)
                {
                    Handles.SphereHandleCap(0, pos, Quaternion.identity, size, EventType.Repaint);
                }
                else if (Handles.Button(pos, Quaternion.identity, size, size, Handles.SphereHandleCap))
                {
                    MapDescriptorEditor.moveTo(collider.transform);
                }
            }
            else
            {
                if (single)
                {
                    Handles.CubeHandleCap(0, collider.transform.position, Quaternion.identity, 0.5f, EventType.Repaint);
                }
                else if (Handles.Button(collider.transform.position, Quaternion.identity, 0.5f, 0.5f, Handles.CubeHandleCap))
                {
                    MapDescriptorEditor.moveTo(collider.transform);
                }
            }
        }

        if (single)
        {
            Handles.BeginGUI();
            GUILayout.BeginVertical(MapDescriptorConfig.textStyle, GUILayout.Width(MapDescriptorConfig.guiWidth));

            GUILayout.Label(surface.gameObject.name, EditorStyles.boldLabel);

            surface.Unclimbable = EditorGUILayout.ToggleLeft("Unclimbable", surface.Unclimbable);
            if (!surface.Unclimbable)
            {
                surface.slipPercentage = EditorGUILayout.FloatField("Slip Percentage", surface.slipPercentage);
            }

            GUILayout.EndVertical();
            Handles.EndGUI();
        }
    }
コード例 #6
0
    public static void DrawTrigger(VmodMonkeMapLoader.Behaviours.ObjectTrigger trigger, bool single = false)
    {
        if (single)
        {
            Handles.BeginGUI();
            GUILayout.BeginVertical(MapDescriptorConfig.textStyle, GUILayout.Width(MapDescriptorConfig.guiWidth * 1.5f));

            GUILayout.Label(trigger.gameObject.name, EditorStyles.boldLabel);

            trigger.DisableObject   = EditorGUILayout.Toggle("Disable Object", trigger.DisableObject);
            trigger.OnlyTriggerOnce = EditorGUILayout.Toggle("Only Trigger Once", trigger.OnlyTriggerOnce);

            trigger.ObjectToTrigger = EditorGUILayout.ObjectField("Object to Trigger", trigger.ObjectToTrigger, typeof(GameObject), true) as GameObject;
            if (trigger.ObjectToTrigger != null)
            {
                if (trigger.ObjectToTrigger.scene != trigger.gameObject.scene)
                {
                    GUILayout.Label("Your Triggered Object is not in the same scene as your trigger!", EditorStyles.boldLabel);
                }
            }
            trigger.TouchType = (VmodMonkeMapLoader.Behaviours.GorillaTouchType)EditorGUILayout.EnumPopup("TouchType", trigger.TouchType);

            trigger.Delay = EditorGUILayout.FloatField("Delay", trigger.Delay);

            GUILayout.EndVertical();
            Handles.EndGUI();
        }
        if (trigger.ObjectToTrigger != null)
        {
            if (trigger.DisableObject)
            {
                Handles.color = (Color.white + Color.red) / 2;
            }
            else
            {
                Handles.color = Color.Lerp(Color.green, Color.cyan, 0.5f);
            }

            if (Handles.Button(trigger.ObjectToTrigger.transform.position, trigger.ObjectToTrigger.transform.rotation, 0.3f, 0.3f, Handles.SphereHandleCap))
            {
                MapDescriptorEditor.moveTo(trigger.ObjectToTrigger.transform);
            }


            if (trigger.OnlyTriggerOnce)
            {
                DrawOnceTrigger(trigger, single);
            }
            else
            {
                DrawMultiTrigger(trigger, single);
            }
            HandleHelpers.ResizeLabel(trigger.ObjectToTrigger.transform.position + Vector3.up, trigger.ObjectToTrigger.gameObject.name);

            Handles.color = Color.cyan;
        }
        else
        {
            Handles.color = Color.red;
        }

        if (single)
        {
            Handles.SphereHandleCap(0, trigger.transform.position, trigger.transform.rotation, 0.4f, EventType.Repaint);
        }
        else
        {
            HandleHelpers.ResizeLabel(trigger.transform.position + Vector3.up, trigger.gameObject.name);
            if (Handles.Button(trigger.transform.position, trigger.transform.rotation, 0.4f, 0.4f, Handles.SphereHandleCap))
            {
                MapDescriptorEditor.moveTo(trigger.transform);
            }
        }
    }