コード例 #1
0
 /// <summary>
 /// Refresh the window content.
 /// </summary>
 public void Refresh()
 {
     OnSelectionChange();
     if (m_ParentGUI != null)
     {
         m_ParentGUI.Refresh();
     }
     InternalStateBehaviour.ResetRefresh();
 }
コード例 #2
0
        /// <summary>
        /// Updates the ParentBehaviourGUI that is showed by the BehaviourWindow.
        /// The new ParentBehaviourGUI is chosen depending on the serialized parent.
        /// </summary>
        void SetParentGUI()
        {
            var serializedParent = EditorUtility.InstanceIDToObject(m_SerializedParentID) as ParentBehaviour;

            // If the type of the serializedParent changed, creates a new GUIController and stores in m_ParentGUI member.
            if (serializedParent == null)
            {
                return;
            }
            else if (serializedParent is InternalStateMachine && (m_ParentGUI == null || !(m_ParentGUI is FsmGUI)))
            {
                if (m_ParentGUI != null)
                {
                    ScriptableObject.DestroyImmediate(m_ParentGUI);
                }

                m_ParentGUI = ScriptableObject.CreateInstance(typeof(BehaviourMachineEditor.FsmGUI)) as ParentBehaviourGUI;
                m_ParentGUI.Refresh();
                if (activeNodeChanged != null)
                {
                    activeNodeChanged();
                }
            }
            else if (serializedParent is InternalBehaviourTree && (m_ParentGUI == null || !(m_ParentGUI is TreeGUI)))
            {
                if (m_ParentGUI != null)
                {
                    ScriptableObject.DestroyImmediate(m_ParentGUI);
                }

                m_ParentGUI = ScriptableObject.CreateInstance(typeof(BehaviourMachineEditor.TreeGUI)) as ParentBehaviourGUI;
                m_ParentGUI.Refresh();
                if (activeNodeChanged != null)
                {
                    activeNodeChanged();
                }
            }
        }
コード例 #3
0
ファイル: BehaviourWindow.cs プロジェクト: xclouder/godbattle
        /// <summary>
        /// Updates the ParentBehaviourGUI that is showed by the BehaviourWindow.
        /// The new ParentBehaviourGUI is chosen depending on the serialized parent.
        /// </summary>
        void SetParentGUI () {
            var serializedParent = EditorUtility.InstanceIDToObject(m_SerializedParentID) as ParentBehaviour;
            // If the type of the serializedParent changed, creates a new GUIController and stores in m_ParentGUI member.
            if (serializedParent == null)
                return;
            else if (serializedParent is InternalStateMachine && (m_ParentGUI == null || !(m_ParentGUI is FsmGUI))) {
                if (m_ParentGUI != null)
                    ScriptableObject.DestroyImmediate(m_ParentGUI);

                m_ParentGUI = ScriptableObject.CreateInstance(typeof(BehaviourMachineEditor.FsmGUI)) as ParentBehaviourGUI;
                m_ParentGUI.Refresh();
                if (activeNodeChanged != null)
                    activeNodeChanged();
            }
            else if (serializedParent is InternalBehaviourTree && (m_ParentGUI == null || !(m_ParentGUI is TreeGUI))) {
                if (m_ParentGUI != null)
                    ScriptableObject.DestroyImmediate(m_ParentGUI);

                m_ParentGUI = ScriptableObject.CreateInstance(typeof(BehaviourMachineEditor.TreeGUI)) as ParentBehaviourGUI;
                m_ParentGUI.Refresh();
                if (activeNodeChanged != null)
                    activeNodeChanged();
            }
        }