void CheckState() { switch (_fsm.state) { case ENEMYSTATES.spawn: EnemySpawn(); //DylanGamePlay.ToggleBossHealth(true, hp, hp); BossUI.ToggleBossGUI(true); break; case ENEMYSTATES.idle: Fire(); _fsm.Transition(_fsm.state, ENEMYSTATES.fly); break; case ENEMYSTATES.fly: Fire(); break; case ENEMYSTATES.special: Fire(); break; case ENEMYSTATES.dead: Destroy(this.gameObject); break; } }
protected override void OnTriggerEnter2D(Collider2D c) { if (c.GetComponent <Projectile>() && c.GetComponent <Projectile>().isEnemy == false) { //Destroys the bullet Destroy(c.gameObject); //Subtracts one hp from the enemy current hp hp--; BossUI.HPChange(1); //Checks if the hp is equal to zero if (hp == 0) { BossUI.ToggleBossGUI(false); //Calls score functions to increase current score //Destorys the enemy ScoreManager.IncreasScoreBy(ScoreValue); Destroy(this.gameObject); //Plays the explosion audio FindObjectOfType <AudioManager>().PlayExplodeAudio(); } } }