using System; using UnityEngine; public class BounceTrigger : MonoBehaviour { private BounceEffect[] bounceEffects; private void Start() { bounceEffects = GetComponents(); RayHitReflect componentInParent = GetComponentInParent(); componentInParent.reflectAction = (Action)Delegate.Combine(componentInParent.reflectAction, new Action(Reflect)); } public void Reflect(HitInfo hit) { for (int i = 0; i < bounceEffects.Length; i++) { bounceEffects[i].DoBounce(hit); } } }