r/gamedev•
Sweeper1986

Turn Based Strategy: Turn-System

Question

So i'm currently working on a TBS-Game in Unity and i came to the point where i have to make the "End of Turn"-Progression. So when the User clicks on "End Turn" the game has to make several steps in a predefined order. f.e.

Step A: Player.move()

Step B: Player.attack()

Step C: Enemy.move()

Step D: Enemy.Attack()

The next Step is only allowed to fire, when the previous Step is complete. I'm working with Javascript at my Job, so i was hoping for something like Promises / Q in Unity, but apparently it's not there. So i could do the same with Events/Callbacks but that often leads to a very messy, complicated Code. My next Idea was to make a Handler that checks constantly in his Update method like:

if(EndOfTurn == true){
    if(currentStep == StepA && Player.movementIsDone()){
        goToStepB()
    }
    if(currentStep == StepB && Player.attackIsDone()){
        goToStepC()
    }
    ...
}

I currently don't see any problems with that approach, but i'm at the beginning of working with Unity and haven't looked into several topics (f.e. Animations) of Game-Development yet. I know i have to rework the System probably several times to fit my needs, but i would like to go in the right direction at least.

So do you have any Ideas, Tipps, Tutorial Suggestions how this is solved properly?

Thanks

Posted Jun 25, 2017, 9:33 AM UTC

89
Loading comments…