Beispiel #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);
        }
    }
Beispiel #2
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();
        }
    }
Beispiel #3
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);
            }
        }
    }