-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLaserCutter.cs
33 lines (30 loc) · 984 Bytes
/
LaserCutter.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
using UnityEngine;
//! This class handles animation of the gear cutter's laser.
public class LaserCutter : MonoBehaviour
{
public GameObject gearCutter;
private StateManager stateManager;
//! Called by unity engine on start up to initialize variables.
public void Start()
{
stateManager = FindObjectOfType<StateManager>();
}
//! Update is called once per frame.
public void Update()
{
if (!stateManager.Busy())
{
if (gearCutter.GetComponent<Light>().enabled == true)
{
GetComponentInChildren<Renderer>().enabled = true;
gearCutter.GetComponent<AudioSource>().enabled = true;
transform.Rotate(-Vector3.up * 600 * Time.deltaTime);
}
else
{
gearCutter.GetComponent<AudioSource>().enabled = false;
GetComponentInChildren<Renderer>().enabled = false;
}
}
}
}