summaryrefslogtreecommitdiff
path: root/Other/NodeEditorExamples/Assets/xNode-examples/Examples/StateMachine/Nodes/Editor/StateNodeEditor.cs
blob: 6ce01956aa0c792771401bbb72779b85c8ae0cc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XNode.Examples.StateGraph;

namespace XNodeEditor.Examples {
	[CustomNodeEditor(typeof(StateNode))]
	public class StateNodeEditor : NodeEditor {

		public override void OnHeaderGUI() {
			GUI.color = Color.white;
			StateNode node = target as StateNode;
			StateGraph graph = node.graph as StateGraph;
			if (graph.current == node) GUI.color = Color.blue;
			string title = target.name;
			GUILayout.Label(title, NodeEditorResources.styles.nodeHeader, GUILayout.Height(30));
			GUI.color = Color.white;
		}

		public override void OnBodyGUI() {
			base.OnBodyGUI();
            StateNode node = target as StateNode;
			StateGraph graph = node.graph as StateGraph;
			if (GUILayout.Button("MoveNext Node")) node.MoveNext();
			if (GUILayout.Button("Continue Graph")) graph.Continue();
			if (GUILayout.Button("Set as current")) graph.current = node;
		}
	}
}