private void Awake() { anim = GetComponent <Animator>(); baseAIScript = GetComponent <BaseAIScript>(); StartCoroutine("basicBrain"); lastState = PumpkinStates.BASIC_ATTACK; }
IEnumerator basicBrain() { baseAIScript.states = BaseAIScript.States.MOVE_AI_NAVMESH; anim.SetBool("IsRunning", true); if (!CurrentlyAttack) { //print("BoolWorks"); // print(lastState); switch (lastState) { case PumpkinStates.BASIC_ATTACK: // print("BasicAttack"); StartCoroutine("SpawnMineEnemies"); lastState = PumpkinStates.MINES; CurrentlyAttack = true; break; case PumpkinStates.WAVE_ATTACK: // print("WaveAttack"); StartCoroutine("BasicAttack"); lastState = PumpkinStates.BASIC_ATTACK; CurrentlyAttack = true; break; case PumpkinStates.MINES: // print("Mines"); StartCoroutine("SinBullets"); lastState = PumpkinStates.WAVE_ATTACK; CurrentlyAttack = true; break; } } yield return(new WaitForSeconds(1f)); }