コード例 #1
0
    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);
    }
コード例 #2
0
 void OnDestroy()
 {
     ExplodeBomb -= Explode;
 }
コード例 #3
0
 void Start()
 {
     timer        = 0.0f;
     activeTimer  = false;
     ExplodeBomb += Explode;
 }