Пример #1
0
        protected virtual void OnEnable()
        {
            Debug.Assert(BaseState >= 0, this.name + " did not have a base state ID. CRASH LOUDLY");

            _currentState = _availiableStates.Count >= 1 ? _availiableStates [BaseState] : _availiableStates [_availiableStates.Keys.First()];
            _currentState.OnEnter();
        }
Пример #2
0
 public void MoveToState(EAIState pendingState)
 {
     if (_availiableStates [pendingState] != null)
     {
         _currentState.OnLeave();
         _currentState = _availiableStates [pendingState];
         _currentState.OnEnter();
     }
 }
Пример #3
0
        private void OnDisable()
        {
            _currentState.OnLeave();

            _currentState = _availiableStates [_availiableStates.Keys.First()];
            var effect = GameObject.FindObjectOfType <NoiseEffect> ();

            if (effect != null)
            {
                //effect.ChangeOpacity (0f);
            }
            _currentState.OnEnter();
        }