22 lines
519 B
C#
22 lines
519 B
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
public class ChangeDownStreamLevel : MonoBehaviour
|
||
{
|
||
|
||
private Vector3 originalPos;
|
||
// 高度范围(根据需要设置)
|
||
public void Start()
|
||
{
|
||
originalPos = transform.position;
|
||
}
|
||
|
||
// 直接在Inspector中绑定到Slider的OnValueChanged
|
||
public void OnSliderValueChanged(float value)
|
||
{
|
||
// 计算高度(将0-1的Slider值映射到高度范围)
|
||
transform.position = originalPos + new Vector3(0f, value, 0f);
|
||
}
|
||
}
|