// TODO : The below function seems to be inefficient, revisit for optimization, if required public override void Update() { non_active_states_temp.Clear(); for (int i = active_states.Count - 1; i >= 0; i--) { FuSMState state = active_states[i]; if (!(state.getActivation() > state.LowerBound)) { state.exit(); active_states.RemoveAt(i); non_active_states_temp.Add(state); } } for (int i = non_active_states.Count - 1; i >= 0; i--) { FuSMState state = non_active_states[i]; if (state.getActivation() > state.LowerBound) { state.enter(); non_active_states.RemoveAt(i); active_states.Add(state); } } non_active_states.AddRange(non_active_states_temp); foreach (FuSMState state in active_states) { state.Update(); } }
public void addState(FuSMState state) { states.Add(state); }