blob: ffe41a8bc2cadba9810dff943f6ab3af33be1c62 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
using UnityEngine;
public class ScaleTrailFromDamage : MonoBehaviour
{
private float startWidth;
private float startTime;
private void Start()
{
float num = 55f;
ProjectileHit componentInParent = GetComponentInParent<ProjectileHit>();
GetComponentInParent<RayCastTrail>();
if ((bool)componentInParent)
{
num = componentInParent.damage;
}
TrailRenderer componentInChildren = GetComponentInChildren<TrailRenderer>();
startWidth = componentInChildren.widthMultiplier;
startTime = componentInChildren.time;
if ((bool)componentInChildren)
{
componentInChildren.widthMultiplier *= (1f + num / 55f) / 2f;
componentInChildren.time *= Mathf.Clamp((1f + num / 55f) / 2f, 0f, 25f);
if (num > 100f)
{
componentInChildren.numCapVertices = 5;
}
if (num > 500f)
{
componentInChildren.numCapVertices = 10;
}
}
}
public void Rescale()
{
float num = 55f;
ProjectileHit componentInParent = GetComponentInParent<ProjectileHit>();
RayCastTrail componentInParent2 = GetComponentInParent<RayCastTrail>();
if ((bool)componentInParent)
{
num = componentInParent.damage;
}
TrailRenderer componentInChildren = GetComponentInChildren<TrailRenderer>();
if ((bool)componentInChildren)
{
_ = componentInParent2.extraSize;
componentInChildren.widthMultiplier = startWidth * ((1f + num / 55f) / 2f);
componentInChildren.time = startTime * Mathf.Clamp((1f + num / 55f) / 2f, 0f, 25f);
if (num > 100f)
{
componentInChildren.numCapVertices = 5;
}
if (num > 100f)
{
componentInChildren.numCapVertices = 10;
}
}
}
}
|