// Update is called once per frame void Update() { if (flinched) { flinchCooldown -= Time.deltaTime; if (flinchCooldown <= 0) { flinched = false; aniscr.Unflinch(); } } else if (currentHealth <= 0) { dead = true; playerRigidbody.velocity = Vector3.zero; playerRigidbody.isKinematic = true; //Physics will no longer apply aniscr.Die(); gameManager.GameOver(); } if (invulnerable) { invulnerabilityTimer -= Time.deltaTime; if (invulnerabilityTimer <= 0) { invulnerable = false; } } //Poisoning routine: suffer one tick of damage every half second until poison wears off if (poisonTimer > 0) //Is poisoned { if (poisonTickTimer <= 0) { TakeDamage(maxHealth * poisonDamageRatio); //Damage tick poisonTickTimer = poisonTickTimerMax; } else { poisonTickTimer -= Time.deltaTime; } poisonTimer -= Time.deltaTime; if (poisonTimer <= 0) //Poison wore off, reset colors { Unpoison(); } } }