Exemplo n.º 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);
        }
    }
Exemplo n.º 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);
        }
    }
Exemplo n.º 3
0
 void DrawGrids()
 {
     if (showGrids)
     {
         HandleHelpers.DrawGrid(GetTextureArea(), scale, GRID_COLOR_MINOR, dragTotal);
         HandleHelpers.DrawGrid(GetTextureArea(), scale * 10, GRID_COLOR_MAJOR, dragTotal);
     }
 }
Exemplo n.º 4
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));
    }
    public static void DrawSpawnPoint(Transform point)
    {
        Handles.color = Color.magenta;

        if (Handles.Button(point.position, point.rotation, 1.0f, 1.0f, Handles.CubeHandleCap))
        {
            moveTo(point);
        }

        HandleHelpers.Label(point.position + Vector3.up * point.lossyScale.y, new GUIContent(point.gameObject.name));
    }
Exemplo n.º 6
0
 public static void DrawOnceTrigger(VmodMonkeMapLoader.Behaviours.ObjectTrigger trigger, bool single = false)
 {
     if (single)
     {
         HandleHelpers.DrawArrow(trigger.transform.position, trigger.ObjectToTrigger.transform.position, 1.5f);
     }
     else
     {
         HandleHelpers.DrawLine(trigger.transform.position, trigger.ObjectToTrigger.transform.position, 1.5f);
     }
 }
Exemplo n.º 7
0
 void DrawGrid(float gridSpacing, Color color)
 {
     HandleHelpers.DrawGrid(position, gridSpacing, color, DragOffset);
 }
Exemplo n.º 8
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();
        }
    }
Exemplo n.º 9
0
        void DrawGrid(float gridSpacing, Color color)
        {
            Rect area = new Rect(Vector2.zero, position.size);

            HandleHelpers.DrawGrid(area, gridSpacing, color, DragOffset);
        }
Exemplo n.º 10
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);
            }
        }
    }