void OnEnable()
        {
            m_State = target as DSMState;

            if (m_State == null)
            {
                return;
            }

            DSMEditorWindow.repaintEvent += Repaint;

            m_DisplayName     = serializedObject.FindProperty("m_DisplayName");
            m_Tag             = serializedObject.FindProperty("m_Tag");
            m_FromTransitions = serializedObject.FindProperty("m_FromTransitions");

            m_ReorderableList = new ReorderableList(serializedObject, m_FromTransitions, true, true, false, true);
            m_ReorderableList.drawElementCallback = DrawTransitionElement;
            m_ReorderableList.drawHeaderCallback  =
                (Rect rect) =>
            {
                EditorGUI.LabelField(rect, "Transitions");
            };

            m_ReorderableList.onRemoveCallback =
                (ReorderableList list) =>
            {
                var element           = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(m_ReorderableList.index);
                var transitionAtIndex = element.objectReferenceValue as DSMTransition;
                m_State.RemoveTransition(transitionAtIndex);
            };
        }
예제 #2
0
        protected override void OnEditorStart()
        {
            if (m_DSMObject == null)
            {
                return;
            }

            m_CurrentState = m_DSMObject.entryPoint as DSMState;
            m_DSMObject.entryPointChanged.AddListener(OnEntryPointChanged);
        }
예제 #3
0
        private void OnValidate()
        {
            if (m_DSMObject == null)
            {
                return;
            }

            m_CurrentState = m_DSMObject.entryPoint as DSMState;
            m_DSMObject.entryPointChanged.AddListener(OnEntryPointChanged);
        }
예제 #4
0
        public void Init(DSMObject a_Parent, DSMState a_From, DSMState a_To, string a_DisplayName = null)
        {
            m_Parent = a_Parent;

            m_DisplayName = a_DisplayName;

            m_From = a_From;
            m_To   = a_To;

            name = m_From.displayName + " -> " + m_To.displayName;
        }
예제 #5
0
        public bool Transition(string a_To)
        {
            if (m_DSMObject == null)
            {
                return(false);
            }

            DSMTransition transition = m_CurrentState.transitions.Find(x => x.states.toState.displayName == a_To) as DSMTransition;

            if (transition == null)
            {
                return(false);
            }

            var newCurrentState = transition.states.toState as DSMState;

            if (newCurrentState == null)
            {
                return(false);
            }

            m_CurrentState = newCurrentState;
            return(true);
        }
예제 #6
0
        public DSMTransition Clone(DSMState a_State)
        {
            var newTransition = MemberwiseClone() as DSMTransition;

            return(newTransition);
        }
예제 #7
0
 public void OnStateDestroyed(DSMState a_State)
 {
     m_States.Remove(a_State);
 }
예제 #8
0
 private void OnEntryPointChanged()
 {
     m_CurrentState = m_DSMObject.entryPoint as DSMState;
 }