GameManager, changing the state to turn-base buttle

Hellow!

My english isn’t exelent, but hope u can understand my post))

I need some help with organize my game.
The idia of game - its an RPG with TurnBase Battles, like Divinity Original Sin.
So how can i organize scripts to change character controll, camera controll and start a battle?

I think i need some GameManager, where declare some sates, like “Game”, “Menu”, “Buttle” etc.
But what next?

Must i set references in GameManager to PlayerController? Or PlayerController must look at GameManager?

Must i have 2 different scripts on Player Character, like PlayerController and PlayerBattleController and just switch them by GamManager?

And if i want to add multiplayer battles pvp, how i need to orginize it?

So i need to understand how to orginize this logic by scripts. I will be thanks for any helps, tutorials etc)

First thing: specific questions. I don’t know that your game requires. I certainly can’t be bothered to pseudocode an entire game mechanic for you.

Second thing: You’ve got the basics down, create two states, switch between them, and only enable player controls on one of them. There’s an advanced tutorial here, but I wouldn’t recommend it if you’re stuck at this phase. It also doesn’t resemble at all Divinity.

Organization and app-wide communication is partly stylistic preference and partly dependent on your game. But I can tell you that my favorite style is using Singletons. Like any design pattern, you can get yourself into a mess by planning poorly, but if used correctly I think they’re very effective.

The one thing I really hated about singletons in Unity was having to deal with loading them from different scenes. I’m currently working on what will be a single-scene game, so it’s not really an issue, but I’m using a great asset called Universe that makes managing your singleton managers so much easier. I would recommend trying them out using the method described in the first link above, and if you like the pattern but want to switch scenes a good bit, consider using Universe.

As far as what types of managers you need and how they communicate, that’s much more dependent on your game. I tend to have an AppManager that handles things like user preferences, saving and loading, etc. For my current game, I have a PlayerManager that handles retrieving and setting player data, a CharacterManager for fetching and modifying generated Characters, a WorldManager that keeps track of locations I’ve created, and a TimeManager for keeping track of the date and time of day. Your needs may be totally different, but that should get you pointed in the right direction.