public virtual void Change(EnemystateMachine nextState) { if (currentState == nextState) { return; } switch (currentState) { case EnemystateMachine.Idle: m_Idle.Exit(this.gameObject); break; case EnemystateMachine.Move: m_Move.Exit(this.gameObject); break; case EnemystateMachine.Attack: m_Attack.Exit(this.gameObject); break; case EnemystateMachine.Death: m_Death.Exit(this.gameObject); break; } currentState = nextState; switch (currentState) { case EnemystateMachine.Idle: m_Idle.Enter(this.gameObject); break; case EnemystateMachine.Move: m_Move.Enter(this.gameObject); break; case EnemystateMachine.Attack: m_Attack.Enter(this.gameObject); break; case EnemystateMachine.Death: m_Death.Enter(this.gameObject); break; } }