public void UpdateGraph(float remaining_weight) { if (_current_transition != null && _current_transition.IsDone()) { // if the current transition is finished, then jump to the destination state _desired_state = _current_state; _current_state = _current_transition.Destination; _current_transition = null; } if (_current_transition != null) { _current_transition.UpdateGraph(remaining_weight); } else { _current_state.UpdateGraph(remaining_weight); if (!_current_state.IsLooping) { // if the current state is not looping, change back immeditately to the previous state (don't worry the transition will know to wait for the non looping state to finish) ChangeState(_desired_state.name); } } }