MWS_2021/Unity Project/Assets/Scripts/Editor/TurtleEditor.cs

36 lines
774 B
C#
Raw Normal View History

2021-04-17 22:09:48 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(TurtleLSystem),true)]
public class TurtleEditor : Editor
{
TurtleLSystem turtleLSystem;
public override void OnInspectorGUI() {
DrawDefaultInspector();
if (GUILayout.Button("Load file")) {
turtleLSystem.loadFile();
}
2021-04-21 18:01:50 +02:00
if (GUILayout.Button("Switch ON/OFF animation")) {
turtleLSystem.switchAnimation();
}
2021-04-17 22:09:48 +02:00
if (GUILayout.Button("Evaluate")) {
turtleLSystem.evaluateAndPresent();
}
}
void OnEnable() {
turtleLSystem = (TurtleLSystem)target;
Tools.hidden = true;
}
void OnDisable() {
Tools.hidden = false;
}
}