Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class FragEffect : GrenadeEffect
- {
- public override void Activate()
- {
- base.Activate();
- var hits = Physics.OverlapSphere(transform.position, _explosionRadius);
- foreach (var hit in hits)
- {
- var rigidbody = hit.GetComponent<Rigidbody>();
- if (rigidbody != null)
- rigidbody.AddExplosionForce(_explosionForce, transform.position, _explosionRadius, _explosionLift, ForceMode.Impulse);
- }
- Instantiate(_explosionEffectPrefab, transform.position, transform.rotation);
- Destroy(gameObject);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement