void Update() { if (inFire) //checks if in fire is true { if (damageTime > timer) //if so, and damage time is greater than timer value { timer += Time.deltaTime; //add time to timer value } else { HealthBar.TakeDamage(); //if not, activate take damage function on healthbar script timer = 0f; //reset timer value to zero } } }