blob: cdb0b0ed3b9ebe730096854974353f2a5f942707 (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
using Sonigon;
using UnityEngine;
public class TrickShot : MonoBehaviour
{
[Header("Sound")]
public SoundEvent soundGrowExplosion;
public SoundEvent soundGrowWail;
private bool soundGrowExplosionPlayed;
private bool soundGrowWailPlayed;
private SoundParameterIntensity soundIntensity = new SoundParameterIntensity(0f);
[Header("Settings")]
public float muiltiplier = 1f;
public float removeAt = 30f;
private ProjectileHit projectileHit;
private MoveTransform move;
private ScaleTrailFromDamage trail;
private float lastDistanceTravelled;
private void Awake()
{
trail = base.transform.root.GetComponentInChildren<ScaleTrailFromDamage>();
}
private void Start()
{
projectileHit = GetComponentInParent<ProjectileHit>();
move = GetComponentInParent<MoveTransform>();
if (projectileHit != null)
{
if (soundGrowExplosion != null)
{
projectileHit.AddHitActionWithData(SoundPlayGrowExplosion);
}
if (soundGrowWail != null)
{
soundGrowWailPlayed = true;
SoundManager.Instance.Play(soundGrowWail, projectileHit.ownPlayer.transform);
}
}
}
public void SoundPlayGrowExplosion(HitInfo hit)
{
if (!soundGrowExplosionPlayed)
{
soundGrowExplosionPlayed = true;
if (soundGrowExplosion != null)
{
SoundManager.Instance.PlayAtPosition(soundGrowExplosion, projectileHit.ownPlayer.transform, hit.point, soundIntensity);
}
if (soundGrowWailPlayed)
{
SoundManager.Instance.Stop(soundGrowWail, projectileHit.ownPlayer.transform);
}
}
}
private void Update()
{
if (move.distanceTravelled > removeAt)
{
Object.Destroy(this);
return;
}
soundIntensity.intensity = move.distanceTravelled / removeAt;
float num = move.distanceTravelled - lastDistanceTravelled;
lastDistanceTravelled = move.distanceTravelled;
float num2 = 1f + num * TimeHandler.deltaTime * base.transform.localScale.x * muiltiplier;
projectileHit.damage *= num2;
projectileHit.shake *= num2;
if ((bool)trail)
{
trail.Rescale();
}
}
}
|