Using Mecanim statemachine to control the overall game turns (Pandemic style game)

Hi all,

I am trying to develop a Pandemic style game (turn base, player against AI which is basically threats that pops up in the world, and random events that happen)

Is it a good idea to use the Mecanim state machine system (animator) to control all that and serve as a game manager ?

Like to create the turns (let player play, use AI to make threats appear, make events happen…).

Would these scripts be in the Mecanim and then that Mecanim be attached to the GameManager empty object ?

Thank you

Well, normally a game manager takes care of a lot of things like game saves, etc, so I’m not sure it would be a replacement for a game manager. State machines are useful and mecanim is a well built visual state machine. There is a tutorial here on using Mecanim for AI behavior:

I will watch the video thank you

Ideally I could do the game state machine (turns, checks…) With Mecanim and the (saves…) rest in a game manager script ?

Because if I want to put the game turns control system in a method in the update function of the GameManager script… It will be like a huge if /else or switch code… ?

You should be able to take care of turns and checks with Mecanim. As far as it being a mess in GameManager, that’s just how the code is written. If you divide things into methods and meaningful chunks of logic, your code will be much easier to debug and read and you should do that whether using Mecanim or GameManager. Your Mecanim code could also easily become a mess. The nice part about Mecanim is that you can visually see it working while the game is running and tell which state you are in, which makes it easier to debug. I’m sure it will be a good experience.