summaryrefslogtreecommitdiff
path: root/Thronefall_v1.0/Decompile/MillRotor.cs
blob: b2ddb0eb24f5bffe6b4757a3ad005672a5bb92f0 (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
37
38
39
40
41
42
43
44
using UnityEngine;

public class MillRotor : MonoBehaviour
{
	public float rotationSpeed = 90f;

	private float acceleration = 10f;

	private float currentSpeed;

	private DayNightCycle daynight;

	private void Start()
	{
		daynight = DayNightCycle.Instance;
	}

	private void Update()
	{
		if (daynight.CurrentTimestate == DayNightCycle.Timestate.Day)
		{
			if (currentSpeed < rotationSpeed)
			{
				currentSpeed += acceleration * Time.deltaTime;
			}
			if (currentSpeed > rotationSpeed)
			{
				currentSpeed = rotationSpeed;
			}
		}
		else if (daynight.CurrentTimestate == DayNightCycle.Timestate.Night)
		{
			if (currentSpeed > 0f)
			{
				currentSpeed -= acceleration * Time.deltaTime;
			}
			if (currentSpeed < 0f)
			{
				currentSpeed = 0f;
			}
		}
		base.transform.Rotate(0f, currentSpeed * Time.deltaTime, 0f, Space.Self);
	}
}