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"); }
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"); }
public override void Setup(IStateMachineContext _context) { context = _context as GameSMContext; }