ZMWSLI0-SL2021-GR11/Projekt/MWSProjekt/Assets/Editor/TurtleEditor.cs

33 lines
617 B
C#
Raw Permalink Normal View History

2021-07-07 19:57:20 +02:00
using UnityEditor;
using UnityEngine;
2021-07-10 00:25:49 +02:00
[CustomEditor(typeof(TreeTurtle), true)]
2021-07-07 19:57:20 +02:00
public class TurtleEditor : Editor
{
2021-07-10 00:25:49 +02:00
TreeTurtle turtleLSystem;
2021-07-07 19:57:20 +02:00
public override void OnInspectorGUI()
{
DrawDefaultInspector();
if (GUILayout.Button("Load file"))
{
turtleLSystem.loadFile();
}
if (GUILayout.Button("Evaluate"))
{
turtleLSystem.evaluateAndPresent();
}
}
void OnEnable()
{
2021-07-10 00:25:49 +02:00
turtleLSystem = (TreeTurtle)target;
2021-07-07 19:57:20 +02:00
Tools.hidden = true;
}
void OnDisable()
{
Tools.hidden = false;
}
2021-07-10 00:25:49 +02:00
}