AlexWills37/Dumpling-Manatee-Simulation

Tutorial task bar gets stuck

Opened this issue · 4 comments

If you go through the tutorial tasks too quickly (finish task 2 while the text is still transitioning to task 2) it will get stuck with the text from the first task

Transition("Task 2")
starts to complete the task, waits until the color transition is complete

Transition("Task 3")
stops the current color transition and starts it over again

Complete color transition finishes, and then "Task 3" is set as the string, and then "Task 2" is set as the string, then they play the reset animation

Maybe instead of interrupting the current coroutine when you play a transition, it should wait for the current one to finish?

Then "Task 3" would get stuck:
Task 2 starts to complete the task
Task 3 attempts to complete the task, but waits for task 2 to finish
Task 2 finishes, updates the text, starts the restart animation
maybe task 3 starts its animation, maybe it doesnt. Either way, it happens after task 2.

If you had the coroutine run 3 times in a row, you would run into the same issue. Some queue would be needed to make it work with all the edge cases, but the one edge case is probably enough for this project

For minimal code changes, I put the delay in the TransitionTask coroutine (animations will still be stopped/interrupted, but now if the coroutine is called twice in a short period of time, it will stagger the animations so that the second instance happens last?

This does not work entirely. Maybe the text should be updated outside of the coroutine (before any delay) so that the NewText is set to whatever the latest instance of the coroutine set it as

Now there is a different issue: the reset task part of the transition coroutine can occur after an external CompleteTask if the player finishes the final task of swimming down before the task starts to appear