Answer the question
In order to leave comments, you need to log in
How to block UI during animations and actions of opponents in card/turn-based games?
I'm thinking of making a simple single-player (against bots) card game in Unity3d. For simplicity, let it be a card game "fool". I haven't written anything serious on Unity3d yet.
The issue of blocking user actions in the presence of a sequence of automatic actions, in addition, accompanied by animations, causes difficulties.
For example, after a player has walked, you need to perform the following actions:
1) show the animation of a card flying to the table
2) after the animation is completed, the move goes to the bot
3) the bot “thinks” for a while
4) the bot beats the player’s card, this is accompanied by the departure animation her on the table
5) waiting for a few seconds
6) the cards fly into the bat
7) players are dealt new cards, ideally through several parallel animations
8) the bot “thinks” for a while
9) the bot moves, this is accompanied by an animation of its departure to the table
10) the move passes to the player, at this moment you need to unlock the UI
I would like to know recommendations :
a) Is it worth starting an FSM for this with long intermediate states like "animated distribution of cards to players"?
b) What is the best way to manage parallel animations? Starts and delays and waiting for all animations to complete. Is yield WaitForSeconds worth it? Will it be necessary to start a counter of currently active animations?
c) Direct control of UI blocking. So far, the simplest thing that comes to mind is to have a global flag "we are waiting for the player's action" (accordingly, in paragraphs 2..9 it will be equal to false) and check it directly when processing the player's clicks.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question