示例#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;
 }