It would be nice to have some kind of Permit() function, that takes a guard as an argument to perform a transition as soon as the guard is true.
The guard could be some kind of Observable<bool> or even a function that returns a bool every time an Observable<T> changes.
This would be extremely useful for some scenarios, where the system needs to make a transition by itself.
It prevents developers from defining triggers just for this purpose, especially if they are not meant to be fired manually.
Consider displaying a short replay in your game. When the replay stops, the state should change from Replaying back to its initial state Gameplay. Instead of defining a Trigger, like ReplayTerminated you could define a guard clause, that performs the transition when the replay ends.
If there is some kind of solution to this, please let me know :)
It would be nice to have some kind of
Permit()function, that takes aguardas an argument to perform a transition as soon as the guard is true.The guard could be some kind of
Observable<bool>or even a function that returns aboolevery time anObservable<T>changes.This would be extremely useful for some scenarios, where the system needs to make a transition by itself.
It prevents developers from defining triggers just for this purpose, especially if they are not meant to be fired manually.
Consider displaying a short replay in your game. When the replay stops, the state should change from
Replayingback to its initial stateGameplay. Instead of defining a Trigger, likeReplayTerminatedyou could define a guard clause, that performs the transition when the replay ends.If there is some kind of solution to this, please let me know :)