void OnTriggerStay(Collider other) { if (other.tag == "Enemy") { if (!onCD && currentHealth > 0) { StartCoroutine(CoolDownDmg()); CurrentHealth -= 10; } } if (other.name == "pickups") { if (!onCD && currentHealth < maxHealth) { StartCoroutine(CoolDownDmg()); CurrentHealth += 10; } } if (other.name == "amazon") { if (currentHealth > 0) { if ((other.tag == "Pick") == false) { HealthCanvas.SetActive(false); GOCanvas.SetActive(false); NLCanvas.SetActive(true); Amber.SetActive(true); clickAudio.Play(); } } } }
void Update() { if (currentHealth <= 0) { Amber.SetActive(true); HealthCanvas.SetActive(false); GOCanvas.SetActive(true); NLCanvas.SetActive(false); ItemCanvas.SetActive(true); Time.timeScale = 0f; //RestartLevel(); } }
void Start() { cachedY = healthTransform.position.y; maxXValue = healthTransform.position.x; minXValue = healthTransform.position.x - healthTransform.rect.width; currentHealth = maxHealth; onCD = false; HealthCanvas.SetActive(true); GOCanvas.SetActive(false); NLCanvas.SetActive(false); Amber.SetActive(true); ItemCanvas.SetActive(true); }