Пример #1
0
        public void Init(IEnemy _enemy)
        {
            enemy   = _enemy;
            enemySM = GetComponent <Animator>();

            context = new EnemySMContext(enemy, EnemyEndStunCallback, EnemyEndDeathCallback, AlertCallback, EnemyEndAlertCallback, LevelManager.instance.GetUIGameplayManager());

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

            GoToStun     += HandleEnemyStun;
            GoToDeath    += HandleEnemyDeath;
            GoToParasite += HandleEnemyParasite;
            GoToRoaming  += HandleEnemyRoaming;

            enemySM.SetTrigger("StartSM");
        }
Пример #2
0
 /// <summary>
 /// Setup of this State. Set the context of the State
 /// </summary>
 /// <param name="_context">Reference to the context of this State</param>
 /// <returns>This Instance</returns>
 public override void Setup(IStateMachineContext _context)
 {
     context = _context as EnemySMContext;
 }