Exemplo n.º 1
0
 void FixedUpdate()
 {
     Collider[] cols = Physics.OverlapSphere(tran.position, 2.0f);
     foreach (Collider col in cols)
     {
         if ((1 << col.gameObject.layer & check_layer) > 0)
         {
             IntObjBase tmp = col.GetComponent <IntObjBase>();
             if (tmp != null)
             {
                 tmp.Damage();
             }
             if (explosive)
             {
                 Instantiate(GameControl.inst.expl_part, tran.position, tran.rotation);
                 ExplosiveDamage(col);
             }
             if (sound != GameSnd.None)
             {
                 SoundScript.CreateSound(tran, SoundHandler.GetSnd(sound));
             }
             Destroy(gameObject);
             return;
         }
     }
 }
Exemplo n.º 2
0
 void ExplosiveDamage(Collider input)
 {
     Collider[] cols = Physics.OverlapSphere(tran.position, 6.0f);
     foreach (Collider col in cols)
     {
         //Ignore self
         if (col == input)
         {
             continue;
         }
         if ((1 << col.gameObject.layer & check_layer) > 0)
         {
             IntObjBase tmp = col.GetComponent <IntObjBase>();
             if (tmp != null)
             {
                 tmp.Damage();
             }
         }
     }
 }
Exemplo n.º 3
0
    IEnumerator Destroy()
    {
        yield return(new WaitForSeconds(1.0f));

        Collider[] cols = Physics.OverlapSphere(tran.position, 8.0f);
        foreach (Collider col in cols)
        {
            if ((1 << col.gameObject.layer & CHECK_LAYER) > 0)
            {
                IntObjBase tmp = col.GetComponent <IntObjBase>();
                if (tmp != null)
                {
                    tmp.Damage();
                }
            }
        }
        Instantiate(GameControl.inst.expl_part, tran.position, tran.rotation);
        SoundScript.CreateSound(tran, SoundHandler.GetSnd(GameSnd.GrenadeEx));
        Destroy(gameObject);
    }