public virtual void AddTransition(StateMachineComponentBase toComponent, StateTransitionRuleBase transitionRuleRule)
        {
            if (transitionList == null)
            {
                transitionList = new Dictionary <StateMachineComponentBase, StateTransitionRuleBase>();
            }

            transitionList[toComponent] = transitionRuleRule;
        }
Exemple #2
0
        public virtual void Initialise(T owner)
        {
            Owner     = owner;
            stateList = new List <StateMachineComponentBase>();

            InitialiseStates();
            InitialiseBranches();

            currentState = GetState(EntryStateName);
        }
Exemple #3
0
        public override StateMachineComponentBase Evaluate()
        {
            var nextState = base.Evaluate();

            if (nextState != this)
            {
                return(nextState);
            }

            var newState = currentState.Evaluate();

            if (newState != currentState)
            {
                currentState = newState;
                currentState.OnEnter();
            }

            return(this);
        }
Exemple #4
0
 public void AddComponent(StateMachineComponentBase component)
 {
     stateList.Add(component);
 }
Exemple #5
0
 public override void OnEnter()
 {
     // Initialise the default state.
     currentState = GetState(EntryStateName);
     currentState.OnEnter();
 }