/// <summary> /// 狀態切換 /// </summary> public void ChangeState(IAIState state) { currestState.Exit(); previousState = currestState; currestState = state; currestState.Enter(); }
//Changes the current Ai state public void ChangeState(IAIState newState) { if (currentAIState != null) { //Runs the state exit code currentAIState.Exit(); } currentAIState = newState; //Do enter state code and send our self as the Enemy currentAIState.Enter(this); }