// Add a new transition to this state-machine public AT_StateTransition AddTransition(AT_State fromState, AT_State toState) { // Create and init the new transition AT_StateTransition trans = AT_Factory.CreateNode<AT_StateTransition>("Transition", this, m_ParentTree); RemoveChild(trans); trans.transform.parent = m_transitionsParent.transform; trans.NodeType = AT_NodeType.kTransition; trans.m_fromState = fromState; trans.m_toState = toState; // Add it to the list m_transitions.Add(trans); return trans; }
public AT_StateTransition( AT_State fromState, AT_State toState ) { m_fromState = fromState; m_toState = toState; NodeType = AT_NodeType.kTransition; }
// Set which state is currently active public void SetStateActive( AT_State state ) { foreach ( AT_Node node in Children ) { AT_State childState = node as AT_State; if (childState != null) { if (state == childState) { childState.SetLocalBlendWeight(1); } else { childState.SetLocalBlendWeight(0); } } } }
void AddState(AT_State state) { Selection.activeGameObject = state.gameObject; m_activeContainer.RemoveChild(state); m_activeContainer.AddChild(state, false); AT_StateMachine sm = m_activeContainer as AT_StateMachine; if (sm.m_startUpState == null) { sm.m_startUpState = state; } state.SetLocalBlendWeight(0); state.SetParentBlendWeight(0); state.SetDirty(); sm.SetDirty(); RebuildTreeGraph(); }