internal void TakeDamages(int damages, PlayerBehaviour player) { _target = player; Lifepoints = Mathf.Clamp(Lifepoints - damages, 0, MaxLifepoints); DamageDisplayer.ShowDamage( damages, transform.position + Vector3.up * 2, new Color(211f / 255, 84f / 255, 0) ); if (Lifepoints > 0) { Collider[] cols = Physics.OverlapSphere(transform.position, CallEnemyRange, ~LayerMask.NameToLayer("Enemy")); if (cols.Length > 0) { foreach (Collider col in cols) { if (col.gameObject.TryGetComponent(out EnemyBehaviour enemy)) { enemy.SetTarget(player); } } } } }
internal void TakeDamages(int damages) { _lifeCooldown = 0; Lifepoints = Mathf.Clamp(Lifepoints - damages, 0, MaxLifepoints); DamageDisplayer.ShowDamage( damages, transform.position + Vector3.up * 2, new Color(142f / 255, 68f / 255, 173f / 255) ); }