public virtual void TakeDamage(float damage) { if (!isAlive || damage <= 0.0f) { return; } if (SupportRange.InSupportRange(gameObject)) { damage *= 0.75f; } HeroUIScript.Damage(damage * (1.0f - dmgDamp * 0.01f), transform.position + Vector3.up * 10.0f); currHP -= damage * (1.0f - dmgDamp * 0.01f); Attacked?.Invoke(); if (currHP <= 0.0f) { currHP = 0.0f; isAlive = false; if (!(this is PortalInfo)) { gameObject.SetActive(false); if (destroyable) { Destroy(gameObject, 1.0f); } } Destroyed?.Invoke(); } }
private void Update() { damage = SupportRange.InSupportRange(gameObject) ? baseDamage * 1.5f : baseDamage; }