diff options
author | chai <215380520@qq.com> | 2023-10-27 11:05:14 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-10-27 11:05:14 +0800 |
commit | 766cdff5ffa72b65d7f106658d1603f47739b2ba (patch) | |
tree | 34d7799a94dfa9be182825577583c0fa6dc935f7 /GameCode/RayHitPoison.cs |
+ init
Diffstat (limited to 'GameCode/RayHitPoison.cs')
-rw-r--r-- | GameCode/RayHitPoison.cs | 36 |
1 files changed, 36 insertions, 0 deletions
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<ProjectileHit>().bulletCanDealDeamage = false; + } + + public override HasToReturn DoHitEffect(HitInfo hit) + { + if (!hit.transform) + { + return HasToReturn.canContinue; + } + RayHitPoison[] componentsInChildren = base.transform.root.GetComponentsInChildren<RayHitPoison>(); + ProjectileHit componentInParent = GetComponentInParent<ProjectileHit>(); + DamageOverTime component = hit.transform.GetComponent<DamageOverTime>(); + if ((bool)component) + { + component.TakeDamageOverTime(componentInParent.damage * base.transform.forward / componentsInChildren.Length, base.transform.position, time, interval, color, soundEventDamageOverTime, GetComponentInParent<ProjectileHit>().ownWeapon, GetComponentInParent<ProjectileHit>().ownPlayer); + } + return HasToReturn.canContinue; + } +} |