コード例 #1
0
        private void DrawTransitionList()
        {
            transitionProperty.serializedObject.Update();

            EditorGUI.BeginChangeCheck();
            {
                popupIndex = EditorGUILayout.Popup(popupIndex, popupList);
            }
            if (EditorGUI.EndChangeCheck())
            {
                EditorNode <AdvancedStateMachineEditorWindow.NodeData> stateNode = AdvancedStateMachineEditorWindow.Instance.FindNodeByStateID(transition.stateID);
                if (stateNode != null)
                {
                    stateNode.RemoveParentNode(node);
                }

                node.RemoveChildNode(stateNode);

                if (popupIndex > 0)
                {
                    node.myData.transition.stateID = AdvancedStateMachineEditorWindow.Target.advancedStates[popupIndex - 1].ID;

                    AdvancedStateMachineEditorWindow.Instance.AttachChildNodeInParentNode(AdvancedStateMachineEditorWindow.Instance.FindNodeByStateID(transition.stateID), node);
                }
                else
                {
                    node.myData.transition.stateID = string.Empty;
                }

                AdvancedStateMachineEditorWindow.Instance.InitializePropertyData();
            }

            transitionProperty.serializedObject.ApplyModifiedProperties();
        }
コード例 #2
0
        private void ClickRemoveItem()
        {
            if (selectedItem == null)
            {
                return;
            }

            node.myData.state.transitions.Remove(selectedItem.data);
            transitions.Remove(selectedItem);

            node.RemoveChildNode(AdvancedStateMachineEditorWindow.Instance.FindNodeByTransition(selectedItem.data));

            RefreshListItemIndex();
        }