SHADE_Y3/Assets/Scripts/UI/SC_SliderText.cs

32 lines
723 B
C#
Raw Normal View History

2023-02-27 09:55:54 +08:00
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class SliderText:Script
{
public GameObject sliderObj;
public int minValue = 0;
public int maxValue = 0;
protected override void update()
{
Slider slider = sliderObj.GetComponent<Slider>();
TextRenderable text = GetComponent<TextRenderable>();
if(slider != null && text != null)
{
Debug.Log("SETTING TEXT");
text.Text = (slider.GetValue() * (maxValue - minValue) + minValue).ToString();
}
}
}
}