summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/DialBehaviour.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/DialBehaviour.cs')
-rw-r--r--Client/Assembly-CSharp/DialBehaviour.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/DialBehaviour.cs b/Client/Assembly-CSharp/DialBehaviour.cs
new file mode 100644
index 0000000..d306e24
--- /dev/null
+++ b/Client/Assembly-CSharp/DialBehaviour.cs
@@ -0,0 +1,46 @@
+using System;
+using UnityEngine;
+
+public class DialBehaviour : MonoBehaviour
+{
+ public FloatRange DialRange;
+
+ public Collider2D collider;
+
+ public Controller myController = new Controller();
+
+ public float Value;
+
+ public bool Engaged;
+
+ public Transform DialTrans;
+
+ public Transform DialShadTrans;
+
+ public void Update()
+ {
+ this.Engaged = false;
+ this.myController.Update();
+ DragState dragState = this.myController.CheckDrag(this.collider, false);
+ if (dragState == DragState.Dragging)
+ {
+ Vector2 vector = this.myController.DragPosition - base.transform.position;
+ float num = Vector2.up.AngleSigned(vector);
+ if (num < -180f)
+ {
+ num += 360f;
+ }
+ num = this.DialRange.Clamp(num);
+ this.SetValue(num);
+ this.Engaged = true;
+ }
+ }
+
+ public void SetValue(float angle)
+ {
+ this.Value = angle;
+ Vector3 localEulerAngles = new Vector3(0f, 0f, angle);
+ this.DialTrans.localEulerAngles = localEulerAngles;
+ this.DialShadTrans.localEulerAngles = localEulerAngles;
+ }
+}