summaryrefslogtreecommitdiff
path: root/Thronefall_v1.0/Decompile/LevelUpScreenAnimation.cs
blob: b0d447673749b2ef989d11c58d3a69ff2d646b31 (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 System.Collections;
using UnityEngine;

public class LevelUpScreenAnimation : MonoBehaviour
{
	public float animationTime = 0.5f;

	public AnimationCurve scaleCurve;

	public Transform target;

	public void Trigger()
	{
		StopAllCoroutines();
		StartCoroutine(Animation());
	}

	private IEnumerator Animation()
	{
		float timer = 0f;
		while (timer < animationTime)
		{
			timer += Time.unscaledDeltaTime;
			target.localScale = Vector3.one * scaleCurve.Evaluate(Mathf.InverseLerp(0f, animationTime, timer));
			yield return null;
		}
		target.localScale = Vector3.one;
	}
}