Manager System Usage example needed

Hi Folks!

I found this really interesting Manager System for Unity3D at http://www.blog.silentkraken.com/2010/06/22/unity3d-manager-systems/ and I really want to use it but don't understand the whole thing.

F.e. I don't understand this GameState-Thing or how to use all the different managers right.

Is anybody intersted in building a short and fast example?

Thnx!

First off, are you familiar with the concept of a Singleton and a Finite-State-Machine? Also you'll need to understand Abstract classes.

With that knowledge under your belt the Manager system in the link you posted should be pretty trivial.

It looks like you'll need to create a few manager classes and use the top level Manager class to manage references to them all. The GameManager in particular holds the GameState machine which can be accessed globally to manage state,

So the flow would probably be something like:

On game startup, create the Manager and setup the GameManager GameStates (i.e. load game, main menu, level 1, level 2, game over etc.) then you set the state to your first game state ( `Manager.GameManager.SetState(MainMenuState)` ) and off you go.

Remember that each state class you create must inherit from the GameState abstract class, for example: public class MainMenuState : GameState and provide it’s own implementations of OnActivate, OnUpdate and OnDeactivate which would do the MainMenuState specific actions.