Storing information in turn based combat

I’m doing a turn based combat game where users can choose all actions their characters take (attacks and targets for attacks etc) in a pre combat phase and then after they have all their options selected the game would move to a combat phase and all these actions would get played out according to a certain order. Currently I am storing the attacker/target/skill in a list of choices, ,choices is a class that has variables for an Attacker, target, skill. These variables are easy enough to store as they are just variables which i can access the necessary methods to enact a skill or do/take damage. In the pre combat phase id like to introduce a moving input where players can set a new position on the screen their character can move to during their turn in the combat phase. I already have a method written to do the movement but the trouble im having is figuring out how to store the movement option as it isnt just a variable but a specific method to call. I was thinking to add an Action delegate as the variable to hold the method in the choices class but dont think i can let each character store its unique move choice (if they do choose to move) in that one delegate while passing the appropriate tiles to move on.

TLDR: trying to find a way where i can store the movement option in pre combat to be carried out on the respective character’s turn in combat. The pre combat input to indicate movement would be something along the lines of drag character to new spot (when dragged an icon would pop out of them) and then place icon onto new spot to indicate where they would move during their turn in combat phase.

I think you’re actually on the right track for delegates, but it might need to be two way, something like a System.Func() that reports progress as you call it again and again.

It would sort of be like a simple coroutine that you pump regularly until it reports “yes, I have finished moving and doing everything, please stop calling me.”

You would probably have a master queueing class that stores these up and then plays them out, letting the entire sequence of battle unfold. You could even have steps in that battle be interactive, or even form the basis for the entire flow of the app.

For instance, to start Turn #1:

  • jam in “get player input” functions into the queue manager and let it rip

  • as each “get player input” function runs, it would accept the player’s input. It would produce output and throw that player’s behaviour game sequence back into the input end of the queue.

  • once all “get player input” delegates have been run out, then the queue would continue into all the stored behaviours and the turn would visibly play out.

  • once the queue is again empty the game would advance to Turn #2 and loop again

It might even be more useful if you make the queueing manager support priorities, such that a higher priority thing would get handled before something else that was lower priority but already waiting in queue.