private GameManager() { userInterface = new List <UI>(); #region FSM stateSetup = new StateGameSetup(this); stateStart = new StateGameStart(this); stateLoop = new StateGameLoop(this); stateWin = new StateGameWin(this); stateLose = new StateGameLose(this); stateSetup.GameStart = stateStart; stateStart.GameLoop = stateLoop; stateLoop.WinLoop = stateWin; stateLoop.LoseLoop = stateLose; stateWin.GameStart = stateStart; stateWin.GameLoop = stateLoop; stateLose.GameStart = stateStart; currentState = stateSetup; stateSetup.OnStateEnter(); #endregion AddComponent(new FSMUpdater(currentState)); }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); stateGameIntro = new StateGameIntro(this); stateGameMenu = new StateGameMenu(this); stateGamePlay = new StateGamePlay(this); stateGameLose = new StateGameLose(this); }