How to create a loop of turn players

Hello! I have a small 2 players turn based game that uses a database. On each player’s turn, an action is executed looking for something in a database, but it is only repeated once (one action for one player). To avoid multiple lookups in that database, I use this simple function.

oneTime = !oneTime;

The thing is that this only works for 2 players and I want to have 4 in total. What function similar to this can I use to manage the input to a 4 player database? Thanks.

Hello,

the best thing is to use a small finite state machine.

The easiest way is to use a TurnManager object, with a script that manages the players and remembers who the phasing player is.