-
Notifications
You must be signed in to change notification settings - Fork 0
/
DarkMatter.cs
36 lines (33 loc) · 971 Bytes
/
DarkMatter.cs
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 DarkMatter: MonoBehaviour
{
private float size;
public GameObject collector;
private StateManager stateManager;
//! Called by unity engine on start up to initialize variables.
public void Start()
{
stateManager = FindObjectOfType<StateManager>();
}
//! Called once per frame by unity engine
public void Update()
{
if (!stateManager.Busy())
{
if (size < 10)
{
transform.localScale = Vector3.Lerp(transform.localScale, new Vector3(10, 10, 10), Time.deltaTime * 0.5f);
size += 1;
}
else if (size >= 10 && size < 20)
{
transform.localScale = Vector3.Lerp(transform.localScale, new Vector3(5, 5, 5), Time.deltaTime * 0.5f);
size += 1;
}
else if (size >= 20)
{
size = 0;
}
}
}
}