WalkStates ( ) : IEnumerable |
A lamp state machine. Typical structure: protected override IEnumerable WalkStates() { [state name]: // State entry actions yield return null; // (wait for a trigger to be called) // State exit actions // Transitions from this state, by checking which trigger has been called if (Trigger == PressSwitch) goto [some other state]; // Throw an exception if the trigger was invalid InvalidState(); [some other state]: ... } |
|