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();
        }
 public void MoveToState(EAIState pendingState)
 {
     if (_availiableStates [pendingState] != null)
     {
         _currentState.OnLeave();
         _currentState = _availiableStates [pendingState];
         _currentState.OnEnter();
     }
 }
        private void OnDisable()
        {
            _currentState.OnLeave();

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

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