123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System.Collections;
- using System.Collections.Generic;
- using XNodeEditor;
- using ChivaVR.State;
- using XNode;
- namespace ChivaVREditor
- {
- [CustomNodeGraphEditor(typeof(StateGraph))]
- public class StateGraphEditor : NodeGraphEditor
- {
- public override void OnOpen()
- {
- base.OnOpen();
- if (serializedObject.FindProperty("enter").objectReferenceValue == null)
- {
- Node node= CreateNode(typeof(EnterStateNode), new UnityEngine.Vector2(0, 0));
- serializedObject.Update();
- serializedObject.FindProperty("enter").objectReferenceValue = node;
- serializedObject.ApplyModifiedProperties();
- }
- if (serializedObject.FindProperty("exit").objectReferenceValue == null)
- {
- Node node = CreateNode(typeof(ExitStateNode), new UnityEngine.Vector2(0, 100));
- serializedObject.Update();
- serializedObject.FindProperty("exit").objectReferenceValue = node;
- serializedObject.ApplyModifiedProperties();
- }
- }
- public override string GetNodeMenuName(System.Type type)
- {
- if (type.Namespace == "ChivaVR.State")
- {
- return base.GetNodeMenuName(type).Replace("Chiva VR/State/", "");
- }
- else return null;
- }
- }
- }
|