diff --git a/Assets/Scripts/Tower/Projectile.cs b/Assets/Scripts/Tower/Projectile.cs index 6157677..ed54230 100644 --- a/Assets/Scripts/Tower/Projectile.cs +++ b/Assets/Scripts/Tower/Projectile.cs @@ -1,5 +1,6 @@ using UnityEngine; using UnityEngine.Assertions; +using UnityEngine.Events; [RequireComponent(typeof(Collider))] public class Projectile : MonoBehaviour @@ -19,6 +20,8 @@ public class Projectile : MonoBehaviour public HealthComponent comingFrom; + public UnityEvent OnReflect; + private Vector3 prevVel; private void Awake() @@ -59,6 +62,8 @@ public class Projectile : MonoBehaviour } Vector3 newVel = Vector3.Reflect(prevVel.normalized, collision.contacts[0].normal.normalized); body.velocity = newVel.normalized * prevVel.magnitude * bounciness; + OnReflect?.Invoke(); + AudioManager.PlaySound("BulletBounce", transform.position); } } }