Exemplo n.º 1
0
 void Detonate()
 {
     poolSystem.Spawn(exposion, transform.position, transform.rotation);
     StaticHelperClass.DamageArea(transform.position, exposionRadius, damage);
     ResetVelocity();
     poolSystem.poolDictionary["grenade-mk2"].Enqueue(gameObject);
     gameObject.SetActive(false);
 }
Exemplo n.º 2
0
 private void OnTriggerEnter(Collider other)
 {
     if (!other.isTrigger)
     {
         StaticHelperClass.DamageArea(transform.position, exposionRadius, damage);
         PoolSystem.Instance.Spawn(exposion, transform.position, Quaternion.identity);
         Destroy(gameObject);
     }
 }
Exemplo n.º 3
0
 private void OnCollisionEnter(Collision collision)
 {
     if (exposion != null && detonateOnImpact)
     {
         poolSystem.Spawn(exposion, collision.GetContact(0).point, Quaternion.LookRotation(collision.GetContact(0).normal));
         StaticHelperClass.DamageArea(collision.GetContact(0).point, exposionRadius, damage);
         ResetVelocity();
         poolSystem.poolDictionary["grenade-mk2"].Enqueue(gameObject);
         gameObject.SetActive(false);
     }
 }
 private void OnCollisionEnter(Collision other)
 {
     if (hitEffect != null)
     {
         if (other.gameObject.GetComponent <Enemy>() != null)
         {
             hitEffect.transform.GetChild(1).GetComponent <ParticleSystemRenderer>().sharedMaterial.color = Color.red;
         }
         else
         {
             hitEffect.transform.GetChild(1).GetComponent <ParticleSystemRenderer>().sharedMaterial.color = new Color(1, 0.99f, 0.8f);
         }
         poolSystem.Spawn(hitEffect, other.GetContact(0).point, Quaternion.LookRotation(other.GetContact(0).normal));
         if (areaDamage)
         {
             StaticHelperClass.DamageArea(other.GetContact(0).point, areaRadius, weaponDamage);
         }
     }
     ResetVelocity();
     poolSystem.poolDictionary[bulletName].Enqueue(gameObject);
     gameObject.SetActive(false);
 }