protected override void ActivateTrapComponent(GameObject enemy) { Damagable damagable = enemy.GetComponent <Damagable>(); if (damagable != null) { damagable.DealDamage(effectValue[0]); } }
private void OnCollisionEnter(Collision collision) { Damagable damagable = collision.gameObject.GetComponent <Damagable>(); if (damagable != null) { damagable.DealDamage(bulletDamage); } Invoke("DetroyBullet", DestroyBulletAfterCollisionTime); }
private void DealDamage(Collider col) { Damagable damagable = col.GetComponentInChildren <Damagable>(); if (damagable != null && damagable.team != team) { damagable.DealDamage(damageAmount); onDamageDealt.Invoke(); } }
private void DealDamage(GameObject toDealDamage) { if (Time.timeSinceLevelLoad > lastTimeHit + actualUnitStatistic.MinTimeBetweenAttacks) { Damagable damagable = toDealDamage.GetComponent <Damagable>(); if (damagable != null) { damagable.DealDamage(actualUnitStatistic.Damage); lastTimeHit = Time.timeSinceLevelLoad; } } }
private void OnTriggerEnter2D(Collider2D collision) { Damagable damagable = collision.GetComponent <Damagable>(); if (damagable != null) { bool healed = damagable.DealDamage(-healPoints); if (healed) { Destroy(gameObject); } } }
private void OnTriggerEnter(Collider other) { Damagable damagable = other.gameObject.GetComponentInParent <Damagable>(); if (damagable == null) { damagable = other.gameObject.GetComponent <Damagable>(); } if (damagable != null) { damagable.DealDamage(gameObject, damage); } print(other.gameObject.name); }