//Decreases the health by a given amount public void take_damage(float amount) { if (tag.Equals("Player")) { AM.Play("PlayerHit"); StartCoroutine(PH.ColorChange(PH.changeTime)); } if (tag.Equals("Broad") || tag.Equals("SimpleEnemy")) { if (health > 0f) { EnemyHit EH = this.GetComponent <EnemyHit>(); StartCoroutine(EH.ColorChange(EH.changeTime)); AM.Play("BroadHit"); } } if (amount < 0) { Debug.LogWarning("Cannot cause negative damage!"); } health = Mathf.Max(health - amount, 0); }