blob: 7bd1bf8707b5f8a20d106d6180ea403f68c4c5c2 (
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
|
using UnityEngine;
public class ChangeDamageMultiplierAfterDistanceTravelled : MonoBehaviour
{
public float muiltiplier = 2f;
public float distance = 10f;
private ProjectileHit hit;
private MoveTransform move;
private TrailRenderer trail;
private void Awake()
{
trail = GetComponentInChildren<TrailRenderer>();
}
private void Start()
{
hit = GetComponent<ProjectileHit>();
move = GetComponent<MoveTransform>();
}
private void Update()
{
if (move.distanceTravelled > distance)
{
hit.damage *= muiltiplier;
hit.shake *= muiltiplier;
if ((bool)trail)
{
trail.widthMultiplier *= 2f;
}
Object.Destroy(this);
}
}
}
|