Example #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;
         }
     }
 }
Example #2
0
 public override void Damage()
 {
     StopAllCoroutines();
     enabled        = false;
     tran.position -= look_pos;
     GameControl.AddScore(100);
     SoundScript.CreateSound(tran, SoundHandler.GetSnd(GameSnd.Death));
     anims.Play("Death");
     StartCoroutine(DelayDestroy());
 }
Example #3
0
 public override void Damage()
 {
     //Prevent any movement when playing death animation
     StopAllCoroutines();
     enabled      = false;
     col.enabled  = false;
     rig.velocity = Vector3.zero;
     GameControl.AddScore(100);
     SoundScript.CreateSound(tran, SoundHandler.GetSnd(GameSnd.Death));
     anims.Play("Death");
     StartCoroutine(DelayDestroy());
 }
Example #4
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);
    }