public void TakeDamage(float amount) { health -= amount; //if shot by player and has not noticed, make enemy angry and always chase player if (!hasNoticed) { attackRadius = Vector3.Distance(target.position, transform.position) * 1.15f; Debug.Log("Shot me in the back? Now I'm angry! Attack radius == " + attackRadius); //moveCloserRadius = attackRadius + 20f; //hasNoticed = true; } if (health <= 0f && !isDead)//if health is below zero and is not already dead { Debug.Log("I, " + gameObject.name + " am dead! Distributing bounty..."); isDead = true; //target.IncreaseScore(10); //call level controller to increase score Level01Controller _lc1 = FindObjectOfType <Level01Controller>(); _lc1.IncreaseScore(bounty); if (gameObject.name == "Enemy_BOOS") { _lc1.KillBoss(); } //start death procedure StartCoroutine(Die()); } }