blob: 514dcbb915b33e48d2e56a74b33acda82ce4ed2c (
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
|
using UnityEngine;
public class UnitSpawnAppear : MonoBehaviour
{
public AnimationCurve scaleCurve;
public float animationTime;
public float initialDelay;
public Transform target;
private float timer;
private float delay;
private void Awake()
{
target.localScale = Vector3.zero;
}
private void Update()
{
delay += Time.deltaTime;
if (!(delay < initialDelay))
{
timer += Time.deltaTime;
target.localScale = Vector3.one * scaleCurve.Evaluate(Mathf.InverseLerp(0f, animationTime, timer));
if (timer > animationTime)
{
base.transform.localScale = Vector3.one;
base.enabled = false;
}
}
}
}
|