예제 #1
0
        public void Init(GameManager _gm)
        {
            gameSM  = GetComponent <Animator>();
            gameMng = _gm;

            context = new GameSMContext(gameMng, HandleGoToLevelCallback, HandleGoToOutcomeCallback, HandleGoToMenuCallback);

            foreach (StateMachineBehaviour state in gameSM.GetBehaviours <StateMachineBehaviour>())
            {
                IState newstate = state as IState;
                if (newstate != null)
                {
                    newstate.Setup(context);
                }
            }

            gameSM.SetTrigger("StartSM");
        }
예제 #2
0
        public void Init(GameManager _gameManager)
        {
            gameSM = GetComponent <Animator>();

            gameManager = _gameManager;
            context     = new GameSMContext(gameManager)
            {
                OnLevelSetupCallback = HandleOnLevelSetup
            };

            foreach (StateMachineBehaviour state in gameSM.GetBehaviours <StateMachineBehaviour>())
            {
                IState newstate = state as IState;
                if (newstate != null)
                {
                    newstate.Setup(context);
                }
            }

            GoToLevelSetup += HandleLevelSetupState;
            GoToMainMenu   += HandleGoToMainMenu;

            gameSM.SetTrigger("StartSM");
        }
예제 #3
0
 public override void Setup(IStateMachineContext _context)
 {
     context = _context as GameSMContext;
 }