| Parameter | Description |
|---|---|
| fromState | The state the transitions originate from. Must belong to this state machine. |
| toState | The state the transitions go to. Must belong to this state machine. |
bool
true if at least one transition existed and was removed; otherwise false.
Removes all transitions that go from one state to another.
Only transitions that leave fromState and enter toState are removed;
transitions in the opposite direction are left untouched. When fromState and
toState are the same state, self transitions on that state are removed, together with
all the rules they hold. To remove a single rule and keep the transition, use
ITransition.RemoveRule instead.
Enclose this method with StateMachine.UndoBeginRecordStateMachine and StateMachine.UndoEndRecordStateMachine to
add this operation to the undo stack and to update the graph view with the changes.
Throws ArgumentNullException when fromState or toState is null.
Throws ArgumentException when either state does not belong to this state machine.
Additional resources: StateMachine.GetTransitions, StateMachine.Connect
The following example removes every transition that goes from one state to another.
void ClearTransitions(StateMachine stateMachine, IState idle, IState patrol) { stateMachine.UndoBeginRecordStateMachine("Clear transitions");
// Removes all Idle -> Patrol transitions, and returns true if there was at least one. // Patrol -> Idle transitions are left untouched. stateMachine.Disconnect(idle, patrol);
// Removes the self transition on Patrol, with all the rules it holds. stateMachine.Disconnect(patrol, patrol);
stateMachine.UndoEndRecordStateMachine(); }