From 766cdff5ffa72b65d7f106658d1603f47739b2ba Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Fri, 27 Oct 2023 11:05:14 +0800 Subject: + init --- GameCode/RayHitPoison.cs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 GameCode/RayHitPoison.cs (limited to 'GameCode/RayHitPoison.cs') diff --git a/GameCode/RayHitPoison.cs b/GameCode/RayHitPoison.cs new file mode 100644 index 0000000..240f2eb --- /dev/null +++ b/GameCode/RayHitPoison.cs @@ -0,0 +1,36 @@ +using Sonigon; +using UnityEngine; + +public class RayHitPoison : RayHitEffect +{ + [Header("Sounds")] + public SoundEvent soundEventDamageOverTime; + + [Header("Settings")] + public float time = 2f; + + public float interval = 0.5f; + + public Color color = Color.red; + + private void Start() + { + GetComponentInParent().bulletCanDealDeamage = false; + } + + public override HasToReturn DoHitEffect(HitInfo hit) + { + if (!hit.transform) + { + return HasToReturn.canContinue; + } + RayHitPoison[] componentsInChildren = base.transform.root.GetComponentsInChildren(); + ProjectileHit componentInParent = GetComponentInParent(); + DamageOverTime component = hit.transform.GetComponent(); + if ((bool)component) + { + component.TakeDamageOverTime(componentInParent.damage * base.transform.forward / componentsInChildren.Length, base.transform.position, time, interval, color, soundEventDamageOverTime, GetComponentInParent().ownWeapon, GetComponentInParent().ownPlayer); + } + return HasToReturn.canContinue; + } +} -- cgit v1.1-26-g67d0