summaryrefslogtreecommitdiffhomepage
path: root/Assets/Scripts/ScaleSlider.cs
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2022-12-07 16:43:35 -0500
committerrealtradam <[email protected]>2022-12-07 16:43:35 -0500
commite0d8634a0aaea9ce8fb4b2683c37edaae53abe3d (patch)
treef829c8f3248f0b0c11c4f11bc85bee4948623f82 /Assets/Scripts/ScaleSlider.cs
parent0cf6c220b1b468cbc2a849fe8d9190f9e0beab8b (diff)
downloadUnityDancingGraph-e0d8634a0aaea9ce8fb4b2683c37edaae53abe3d.tar.gz
UnityDancingGraph-e0d8634a0aaea9ce8fb4b2683c37edaae53abe3d.zip
added interactive ui and customized skybox
Diffstat (limited to 'Assets/Scripts/ScaleSlider.cs')
-rw-r--r--Assets/Scripts/ScaleSlider.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/Assets/Scripts/ScaleSlider.cs b/Assets/Scripts/ScaleSlider.cs
new file mode 100644
index 0000000..69bb58f
--- /dev/null
+++ b/Assets/Scripts/ScaleSlider.cs
@@ -0,0 +1,24 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+using TMPro;
+
+public class ScaleSlider : MonoBehaviour
+{
+ public Slider slider;
+ private Graph graph;
+ private TMP_Text text;
+
+ void Awake()
+ {
+ var gameObjectGraph = GameObject.Find("Graph");
+ graph = gameObjectGraph.GetComponent<Graph>();
+ var gameObjectText = GameObject.Find("ScaleText");
+ text = gameObjectText.GetComponent<TMP_Text>();
+ slider.onValueChanged.AddListener((value) => {
+ graph.SetFunctionScale((float)value);
+ text.text = "Function Scale: " + value.ToString("0.0");
+ });
+ }
+}