示例#1
0
        //======================================================
        //## TODO
        //======================================================
        public void CopyNode()
        {
            if (selectNode == null)
            {
                return;
            }

            if (selectNode.myData.type == NodeType.STATE)
            {
                AdvancedStateMachine.AdvancedState state = new AdvancedStateMachine.AdvancedState();
                //state.ID = "copy_" + selectNode.myData.state.ID;


                Target.advancedStates.Add(state);

                InitializePropertyData();

                InitializeStateNames();

                //serializedObject.Update();
                //serializedObject.Co
                //SerializedProperty test2 = propertyStates.GetEndProperty();
                //test2 = propertyStates.GetArrayElementAtIndex(FindStateIndexByNode(selectNode)).Copy();

                serializedObject.ApplyModifiedProperties();

                EditorNode <NodeData> node = CreateStateNode(state, new Vector2(selectNode.rect.position.x + 15, selectNode.rect.position.y + 15), state.ID);
                SelectNode(node);
            }
            else if (selectNode.myData.type == NodeType.TRANSITION)
            {
            }
        }
示例#2
0
        public EditorNode <NodeData> FindNodeByState(AdvancedStateMachine.AdvancedState state)
        {
            if (state == null)
            {
                return(null);
            }

            if (state.ID == null)
            {
                return(null);
            }

            for (int i = 0; i < editorNodes.Count; i++)
            {
                if (editorNodes[i].myData.type != NodeType.STATE)
                {
                    continue;
                }

                if (editorNodes[i].myData.state.ID == state.ID)
                {
                    return(editorNodes[i]);
                }
            }

            return(null);
        }
示例#3
0
        private void InitializeNode()
        {
            if (editorNodes == null)
            {
                editorNodes = new List <EditorNode <NodeData> >();
            }

            editorNodes.Clear();

            if (selected == null)
            {
                return;
            }

            for (int i = 0; i < selected.advancedStates.Count; i++)
            {
                AdvancedStateMachine.AdvancedState state = selected.advancedStates[i];

                CreateStateNode(state, new Vector2(30.0f + (i * 10.0f), 30.0f + (i * 10.0f)), state.ID);
            }

            for (int i = 0; i < Transitions.Length; i++)
            {
                CreateTransitionNode(Transitions[i], new Vector2(60.0f + (i * 10.0f), 30.0f + (i * 10.0f)), Transitions[i].ID);
            }
        }
示例#4
0
        private EditorNode <NodeData> CreateStateNode(AdvancedStateMachine.AdvancedState state, Vector2 position, string title)
        {
            EditorNode <NodeData> node = new EditorNode <NodeData>(new NodeData(NodeType.STATE, state, null)
                                                                   , editorNodes.Count
                                                                   , new Rect(position.x - (NODE_WIDTH * 0.5f), position.y - (NODE_HEIGHT * 0.5f), NODE_WIDTH, NODE_HEIGHT)
                                                                   , title
                                                                   , (GUIStyle)"flow node hex 4", (GUIStyle)"flow node hex 4 on"
                                                                   , OnStateNodeGenericMenu);

            editorNodes.Add(node);

            return(node);
        }
示例#5
0
 public void SelectNodeByState(AdvancedStateMachine.AdvancedState state)
 {
     for (int i = 0; i < editorNodes.Count; i++)
     {
         if (editorNodes[i].myData.type == NodeType.STATE)
         {
             if (editorNodes[i].myData.state.ID == state.ID)
             {
                 SelectNode(editorNodes[i]);
                 return;
             }
         }
     }
 }
示例#6
0
        //TODO : 동일한 ID 입력에 대한 예외처리 해주
        public void CreateState(Vector2 position)
        {
            AdvancedStateMachine.AdvancedState state = new AdvancedStateMachine.AdvancedState();
            //state.ID = "New State" + Target.advancedStates.Count;
            Target.advancedStates.Add(state);

            InitializePropertyData();

            InitializeStateNames();

            EditorNode <NodeData> node = CreateStateNode(state, position, state.ID);

            SelectNode(node);

            SaveData();
        }
示例#7
0
 public NodeData(NodeType type, AdvancedStateMachine.AdvancedState state, AdvancedStateMachine.AdvancedTransition transition)
 {
     this.type       = type;
     this.state      = state;
     this.transition = transition;
 }