private BossGUI BossUI; //Refrence to the BossUI element // Use this for initialization protected override void Start() { GUIManager.instance.Activate("UIBoss", true); if (BossUI == null) { BossUI = FindObjectOfType <BossGUI>(); } hp = 15; BossUI.HPChange(hp); base.Start(); }
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(); } } }