From e0d8634a0aaea9ce8fb4b2683c37edaae53abe3d Mon Sep 17 00:00:00 2001 From: realtradam Date: Wed, 7 Dec 2022 16:43:35 -0500 Subject: added interactive ui and customized skybox --- Assets/Scripts/ScaleSlider.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Assets/Scripts/ScaleSlider.cs (limited to 'Assets/Scripts/ScaleSlider.cs') 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(); + var gameObjectText = GameObject.Find("ScaleText"); + text = gameObjectText.GetComponent(); + slider.onValueChanged.AddListener((value) => { + graph.SetFunctionScale((float)value); + text.text = "Function Scale: " + value.ToString("0.0"); + }); + } +} -- cgit v1.2.3