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); }; }
protected override void OnEditorStart() { if (m_DSMObject == null) { return; } m_CurrentState = m_DSMObject.entryPoint as DSMState; m_DSMObject.entryPointChanged.AddListener(OnEntryPointChanged); }
private void OnValidate() { if (m_DSMObject == null) { return; } m_CurrentState = m_DSMObject.entryPoint as DSMState; m_DSMObject.entryPointChanged.AddListener(OnEntryPointChanged); }
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; }
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); }
public DSMTransition Clone(DSMState a_State) { var newTransition = MemberwiseClone() as DSMTransition; return(newTransition); }
public void OnStateDestroyed(DSMState a_State) { m_States.Remove(a_State); }
private void OnEntryPointChanged() { m_CurrentState = m_DSMObject.entryPoint as DSMState; }