Skip to content

Transitions based on Guards #641

@schfn

Description

@schfn

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions