Example #1
0
        public bool ChangeState(string key)
        {
            FiniteStateMachineNode retval;

            if (_states.TryGetValue(key, out retval))
            {
                _currentState.OnExit();
                _currentState = retval;
                _currentState.OnEnter();
                return(true);
            }
            return(false);
        }
Example #2
0
        public bool Start(string key)
        {
            FiniteStateMachineNode retval;

            if (_states.TryGetValue(key, out retval))
            {
                _currentState = retval;
                isRunning     = true;
                return(true);
            }
            Debug.LogError("WARNING - " + key + " does not exsist! Cannot start the StateMachine!");
            return(false);
        }
Example #3
0
        public bool Add(FiniteStateMachineNode state, string key)
        {
            FiniteStateMachineNode retval;

            if (_states.TryGetValue(key, out retval))
            {
                return(false);
            }
            else
            {
                _states.Add(key, state);
                return(true);
            }
        }