// Finding exploding targets with colliders void Explode() { Collider[] monsters = Physics.OverlapSphere(transform.position, explosionRange); for (int i = 0; i < monsters.Length; i++) { IMonster mc = monsters[i].GetComponent <IMonster>(); if (mc != null) { mc.GetDamage(damage); } } GameObject ptl = Instantiate(particles, transform.position, transform.rotation); Destroy(ptl, 2f); Destroy(gameObject); }
public void Attack(IMonster monster) { Console.WriteLine("Вы атаковали монстра"); monster.GetDamage(weapon.GetDamage()); }