// Interaction Block void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.CompareTag("key")) { noDoorText.gameObject.SetActive(true); Invoke("DeactivateDoorText", 2); Destroy(other.gameObject); //destroy key item when player collides with it GameManager.keyCount++; //add 1 to keyCount value } if (other.gameObject.CompareTag("door") && GameManager.keyCount < 1) { noKeyText.gameObject.SetActive(true); Invoke("DeactivateKeyText", 2); } if (other.gameObject.CompareTag("door") && GameManager.keyCount >= 1) { SceneManager.LoadScene("bossdialogue"); } if (other.gameObject.CompareTag("enemy")) { SceneManager.LoadScene("DeathScene"); } if (other.gameObject.tag == "stake") { other.gameObject.SetActive(false); gotStake = true; stakeDisplay.SetActive(true); } if (other.gameObject.CompareTag("boss")) { if (gotStake) { stakeDisplay.SetActive(false); gotStake = false; Debug.Log(bossHealth); if (bossHealth == 4) { bossHealth -= 1; stake2.SetActive(true); } else if (bossHealth == 3) { bossHealth -= 1; stake3.SetActive(true); } else if (bossHealth == 2) { bossHealth -= 1; stake4.SetActive(true); } else if (bossHealth == 1) { SceneManager.LoadScene("postcombatdialogue"); } } else { healthControl.updateHealthBar(); } } }