summaryrefslogtreecommitdiff
path: root/GameCode/BounceTrigger.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-10-27 11:05:14 +0800
committerchai <215380520@qq.com>2023-10-27 11:05:14 +0800
commit766cdff5ffa72b65d7f106658d1603f47739b2ba (patch)
tree34d7799a94dfa9be182825577583c0fa6dc935f7 /GameCode/BounceTrigger.cs
+ init
Diffstat (limited to 'GameCode/BounceTrigger.cs')
-rw-r--r--GameCode/BounceTrigger.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/GameCode/BounceTrigger.cs b/GameCode/BounceTrigger.cs
new file mode 100644
index 0000000..8d7a1b5
--- /dev/null
+++ b/GameCode/BounceTrigger.cs
@@ -0,0 +1,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);
+ }
+ }
+}