public void decreaseHP(float point, CarStatus attacker = null) { float decreasedAmount = Mathf.Min(point * Mathf.Max(0, 1 - damageReduction), currHP); // it is possible being attack by yourself if your poison ability is reflected if (attacker != null && attacker != this && attacker.lifeStealAbility > 0) { float lsAmount = decreasedAmount * attacker.lifeStealAbility; if (lsAmount > 0) { attacker.increaseHP(lsAmount); } } currHP = Mathf.Clamp(currHP - decreasedAmount, 0, currHP); // destroy car if (currHP <= 0) { if (reviveAbility > 0) { --reviveAbility; currHP = getMaxHP(); currMP = getMaxMP(); poisonTimer = poisonTime + 1; stunnedTimer = stunningTime + 1; Quaternion spwanRot = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(90, 0, 0)); Instantiate(reviveAnime, transform.position, spwanRot, transform); } else { Instantiate(explosionOnDead, transform.position, transform.rotation); Destroy(gameObject); } } }