neuecc / UniRx

Reactive Extensions for Unity
MIT License
7.01k stars 895 forks source link

what is the best approach to use unirx with mono functionionality like move towards and play animations sequntially? #505

Open virtouso opened 2 years ago

virtouso commented 2 years ago

hi.

for a turn-based game, I need to do some actions sequentially.

for example, moving an object to a position, then playing animation, and then doing a change in UI. I think using RX is a good solution for this but I don't know how to use it?

on documentation, unirx suggests using coroutines with rx. is it the best choice?

rus89 commented 2 years ago

👋 @virtouso,

I don't know what's the best solution for your problem, but I have some ideas that maybe can help you out. You can fire an event with MessageBroker after every of the before mentioned actions are completed, and register listeners that are interested in knowing when those actions are completed. Also, if you are performing those actions with UniRx, then you can use OnCompleted event to do the next action in the sequence

Hope this will help you out 🙂