summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Decompile/Thronefall/SpawnAttackAfter.cs
blob: 804804dfe8eeef49ca886274d0d14fd07b53aa75 (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
using Shapes;
using UnityEngine;

public class SpawnAttackAfter : MonoBehaviour
{
	[SerializeField]
	private Weapon spwanAttackOnDeath;

	[SerializeField]
	private float delay;

	[SerializeField]
	private Disc disc;

	public ThronefallAudioManager.AudioOneShot sound;

	[SerializeField]
	private bool isPlayerAttack;

	public float damageMultiplyer = 1f;

	private float startRadius;

	private float startDelay;

	public Weapon SpwanAttackOnDeath
	{
		get
		{
			return spwanAttackOnDeath;
		}
		set
		{
			spwanAttackOnDeath = value;
		}
	}

	private TaggedObject taggedObject { get; set; }

	private void Start()
	{
		startRadius = disc.Radius;
		startDelay = delay;
		ThronefallAudioManager.WorldSpaceOneShot(sound, base.transform.position);
		if (isPlayerAttack)
		{
			damageMultiplyer *= PlayerUpgradeManager.instance.PlayerDamageMultiplyer;
		}
	}

	private void Update()
	{
		delay -= Time.deltaTime;
		if (delay <= 0f)
		{
			if ((bool)spwanAttackOnDeath)
			{
				spwanAttackOnDeath.Attack(base.transform.position, null, Vector3.zero, taggedObject, damageMultiplyer);
			}
			Object.Destroy(base.gameObject);
		}
		else
		{
			disc.Radius = Mathf.Lerp(startRadius, 0f, delay / startDelay);
		}
	}
}