summaryrefslogtreecommitdiff
path: root/GameCode/RayHitPoison.cs
blob: 240f2eb9cda6ec18e47a7e869af48de1664c644a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
	}
}