public void ChangeState(AI_State nextState) { currentState.EndStateForBrain(this); previousState = currentState; currentState = nextState; currentState.InitializeStateForBrain(this); }
private void Awake() { currentState = initialState; navMeshAgent = this.transform.GetComponent <NavMeshAgent>(); brain_animator = this.transform.GetComponent <Animator>(); brain_rigidbody = this.transform.GetComponent <Rigidbody>(); if (currentState != null) { currentState.InitializeStateForBrain(this); } }