Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class FragEffect : GrenadeEffect
  6. {
  7. public override void Activate()
  8. {
  9. base.Activate();
  10.  
  11. var hits = Physics.OverlapSphere(transform.position, _explosionRadius);
  12. foreach (var hit in hits)
  13. {
  14. var rigidbody = hit.GetComponent<Rigidbody>();
  15. if (rigidbody != null)
  16. rigidbody.AddExplosionForce(_explosionForce, transform.position, _explosionRadius, _explosionLift, ForceMode.Impulse);
  17. }
  18.  
  19. Instantiate(_explosionEffectPrefab, transform.position, transform.rotation);
  20.  
  21. Destroy(gameObject);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement