// Update is called once per frame void Update() { damageTaken = barScript.damageDone; #region Check if Dead if (health <= 0) { if (!_isBoss) { doDamageScript.enabled = false; } if (_isDead == false) { if (!_isBoss) { barScript.SetScore(barScript.GetScore() + Random.Range(2, 7)); deathAnim.DOPlayById("DEATH"); float pickReward = Random.value; if (pickReward >= 0.1f) { Loot(0); if (barScript.GetGoldTooth() == true) { Loot(0); } } else { Loot(1); } } else { barScript.SetScore(barScript.GetScore() + 10); Loot(2); } //If boss do instant death timer else apply 2 seconds of death time if (_isBoss) { StartCoroutine("DeathTimer", 0f); } else { StartCoroutine("DeathTimer", 1.5f); } //audioS.PlayOneShot(deathSound, 1.0F); _isDead = true; } } #endregion #region Flash when enemy is hit if (flashTime > 0) { flashTime -= Time.deltaTime; flash.SetActive(true); } else if (flashTime <= 0) { flashTime = 0; flash.SetActive(false); } #endregion }