blob: 8d7a1b55e79b3c3abef98156850580d813b07b77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
using System;
using UnityEngine;
public class BounceTrigger : MonoBehaviour
{
private BounceEffect[] bounceEffects;
private void Start()
{
bounceEffects = GetComponents<BounceEffect>();
RayHitReflect componentInParent = GetComponentInParent<RayHitReflect>();
componentInParent.reflectAction = (Action<HitInfo>)Delegate.Combine(componentInParent.reflectAction, new Action<HitInfo>(Reflect));
}
public void Reflect(HitInfo hit)
{
for (int i = 0; i < bounceEffects.Length; i++)
{
bounceEffects[i].DoBounce(hit);
}
}
}
|