summaryrefslogtreecommitdiff
path: root/GameCode/Rage.cs
blob: 0e514dd72a739a0ce0202879438fa38d62c1b4b6 (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
using UnityEngine;

public class Rage : MonoBehaviour
{
	private Player player;

	private AttackLevel level;

	public AnimationCurve curve;

	public AnimationCurve partCurve;

	private ParticleSystem.EmissionModule part;

	private void Start()
	{
		player = GetComponentInParent<Player>();
		level = GetComponentInParent<AttackLevel>();
		part = GetComponentInChildren<ParticleSystem>().emission;
		player.data.SetWobbleObjectChild(GetComponentInChildren<ParticleSystem>().transform);
	}

	private void Update()
	{
		float healthPercentage = player.data.HealthPercentage;
		player.data.stats.rageSpeed = Mathf.Pow(curve.Evaluate(healthPercentage), level.LevelScale());
		part.rateOverTime = partCurve.Evaluate(player.data.stats.rageSpeed);
	}
}