2020-09-03 03:09:26 -04:00
|
|
|
|
using UnityEngine;
|
2020-07-19 21:36:57 -04:00
|
|
|
|
|
2020-09-16 21:40:25 -05:00
|
|
|
|
//! This class handles animations for reactor turbines.
|
2020-07-19 21:36:57 -04:00
|
|
|
|
public class TurbineImpeller : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public GameObject turbine;
|
2020-09-19 20:29:43 -05:00
|
|
|
|
private StateManager stateManager;
|
|
|
|
|
|
|
|
|
|
//! Called by unity engine on start up to initialize variables.
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
stateManager = FindObjectOfType<StateManager>();
|
|
|
|
|
}
|
2020-07-19 21:36:57 -04:00
|
|
|
|
|
2020-09-16 21:40:25 -05:00
|
|
|
|
//! Update is called once per frame.
|
2020-07-19 21:36:57 -04:00
|
|
|
|
void Update()
|
|
|
|
|
{
|
2020-09-19 20:29:43 -05:00
|
|
|
|
if (!stateManager.Busy())
|
2020-07-19 21:36:57 -04:00
|
|
|
|
{
|
2020-09-19 20:29:43 -05:00
|
|
|
|
if (turbine.GetComponent<AudioSource>().isPlaying == true)
|
|
|
|
|
{
|
|
|
|
|
transform.Rotate(-Vector3.forward * 600 * Time.deltaTime);
|
|
|
|
|
}
|
2020-07-19 21:36:57 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|