public void StateUpdate() { this._thisFSM.PreUpdate(this); _stateTime += Time.deltaTime; ++_stateCounter_Frame; if (this._stateID_Next != FSM.StateID_Invalid) { // do change state // do Leave _currentState.Leave(_thisFSM, this); // change state this._stateID_Prev = this._stateID_Curr; this._stateID_Curr = this._stateID_Next; this._currentState = _thisFSM.GetState(this._stateID_Next); this._stateID_Next = FSM.StateID_Invalid; // reset property this._stateTime = 0.0f; this._stateCounter_Frame = 1; this._stateCounter_Repeat = (this._stateID_Curr == this._stateID_Prev) ? this._stateCounter_Repeat + 1 : 1; // do Enter this._currentState.Enter(_thisFSM, this); } // do state update this._currentState.Update(_thisFSM, this); this._thisFSM.PostUpdate(this); }