38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class CeShiJuLi : MonoBehaviour
|
|
{
|
|
public Text text1;
|
|
public Text text2;
|
|
public Slider slider1;
|
|
public Slider slider2;
|
|
public Transform transform1;
|
|
public Transform transform2;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
// 获取 slider1 的值
|
|
float sliderValue1 = slider1.value;
|
|
// 更新 transform1 的 y 坐标
|
|
transform1.position = new Vector3(transform1.position.x, sliderValue1, transform1.position.z);
|
|
// 将 slider1 的值显示在 text1 中
|
|
text1.text = (sliderValue1).ToString();
|
|
// 获取 slider2 的值
|
|
float sliderValue2 = slider2.value;
|
|
// 更新 transform2 的 y 坐标
|
|
transform2.position = new Vector3(transform2.position.x, sliderValue2, transform2.position.z);
|
|
// 将 slider2 的值显示在 text2 中
|
|
text2.text = (sliderValue2+90).ToString();
|
|
}
|
|
}
|