예제 #1
0
        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));
        }
예제 #2
0
 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);
 }