36 lines
810 B
C#
36 lines
810 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEditor;
|
||
|
using UnityEngine;
|
||
|
[CustomEditor(typeof(TurtleLSystemEnvironment),true)]
|
||
|
public class TurtleEditorEnv : Editor
|
||
|
{
|
||
|
TurtleLSystemEnvironment turtleLSystem;
|
||
|
|
||
|
|
||
|
public override void OnInspectorGUI() {
|
||
|
DrawDefaultInspector();
|
||
|
|
||
|
if (GUILayout.Button("Load file")) {
|
||
|
turtleLSystem.loadFile();
|
||
|
}
|
||
|
|
||
|
if (GUILayout.Button("Switch ON/OFF animation")) {
|
||
|
turtleLSystem.switchAnimation();
|
||
|
}
|
||
|
|
||
|
if (GUILayout.Button("Evaluate")) {
|
||
|
turtleLSystem.evaluateAndPresent();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
void OnEnable() {
|
||
|
turtleLSystem = (TurtleLSystemEnvironment)target;
|
||
|
Tools.hidden = true;
|
||
|
}
|
||
|
|
||
|
void OnDisable() {
|
||
|
Tools.hidden = false;
|
||
|
}
|
||
|
}
|