private void BombExplosion(Vector3 _pos) { OnBombExplode?.Invoke(); GameObject effect = Instantiate(explosionEffect, _pos, Quaternion.identity) as GameObject; Collider[] hits = Physics.OverlapSphere(_pos, gamePlayManager.gameSettings.bombRadius); foreach (Collider c in hits) { Unit unit = c.GetComponent <Unit>(); if (unit) { unit.Kill(); } } Destroy(effect, 1.5f); }
void OnDestroy() { ExplodeBomb -= Explode; }
void Start() { timer = 0.0f; activeTimer = false; ExplodeBomb += Explode; }