Example #1
0
 public void Stop()
 {
     if (_current != null)
     {
         _current.Ended -= OnActionEnd;
         _current.End(ActionStatus.Inactive);
         _current = null;
     }
     _state = BehaiourState.None;
 }
Example #2
0
        public void SelectState(BehaiourState state)
        {
            Stop();

            IGameAction action;

            if (!_behaviours.TryGetValue(state, out action))
            {
                return;
            }
            _current        = action;
            _state          = state;
            _current.Ended += OnActionEnd;
            _current.Start();
        }
Example #3
0
 public void Register(BehaiourState state, IGameAction action)
 {
     InitializeContext(action);
     _behaviours[state] = action;
 }