diff options
author | chai <chaifix@163.com> | 2022-06-28 09:40:37 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-06-28 09:40:37 +0800 |
commit | 49b25e755b70ec412feaaf0b898d6f7e09d2bea6 (patch) | |
tree | 3c5f4260f30d1c2d7196db93153700d7ddec3157 /Other/NodeEditorExamples/Assets/xNode-examples/Examples/StateMachine/Nodes/Editor | |
parent | c92269331692feca2c276649f6c4ee8911f1f859 (diff) |
+node example
Diffstat (limited to 'Other/NodeEditorExamples/Assets/xNode-examples/Examples/StateMachine/Nodes/Editor')
2 files changed, 43 insertions, 0 deletions
diff --git a/Other/NodeEditorExamples/Assets/xNode-examples/Examples/StateMachine/Nodes/Editor/StateNodeEditor.cs b/Other/NodeEditorExamples/Assets/xNode-examples/Examples/StateMachine/Nodes/Editor/StateNodeEditor.cs new file mode 100644 index 00000000..f9d6b9eb --- /dev/null +++ b/Other/NodeEditorExamples/Assets/xNode-examples/Examples/StateMachine/Nodes/Editor/StateNodeEditor.cs @@ -0,0 +1,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; + } + } +}
\ No newline at end of file diff --git a/Other/NodeEditorExamples/Assets/xNode-examples/Examples/StateMachine/Nodes/Editor/StateNodeEditor.cs.meta b/Other/NodeEditorExamples/Assets/xNode-examples/Examples/StateMachine/Nodes/Editor/StateNodeEditor.cs.meta new file mode 100644 index 00000000..e5414c99 --- /dev/null +++ b/Other/NodeEditorExamples/Assets/xNode-examples/Examples/StateMachine/Nodes/Editor/StateNodeEditor.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: f59d4dfd6e73e6b4d9d14256bc7a20f3 +timeCreated: 1514506333 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |