-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPressureGaugeScript.cs
More file actions
46 lines (40 loc) · 1.18 KB
/
PressureGaugeScript.cs
File metadata and controls
46 lines (40 loc) · 1.18 KB
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
45
46
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PressureGaugeScript : MonoBehaviour
{
//bool reachedTargetRot;
bool newTargetRot = true;
float randRot;
float currentRot;
public float startRot;
public float endRot;
void Update()
{
if (newTargetRot)
{
//currentRot = transform.localRotation.eulerAngles.y;
//randRot = Random.Range(-25f, 200f);
StartCoroutine(Rotator());
newTargetRot = false;
}
}
IEnumerator Rotator()
{
startRot = startRot - 1f;
transform.localRotation = Quaternion.Euler(new Vector3(0f, startRot, 0f));
yield return new WaitForSeconds(0.005f);
//yield return new WaitUntil(RotateFunc);
yield return null;
newTargetRot = true;
}
bool RotateFunc()
{
//float angularDiff = Mathf.Sqrt( (currentRot * currentRot) - (randRot * randRot));
for (int i = 0; i < 100; i++)
{
transform.localRotation = Quaternion.Euler(new Vector3(0f, i, 0f));
}
return true;
}
}