20261017
This commit is contained in:
1 parent
caf19faf09
commit
c4b10383f9
18 files changed
+3295
-1524
No files matched your search
@@ -0,0 +1,40 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class Fov : MonoBehaviour
|
||||
{
|
||||
[Header("UI 參照")]
|
||||
[Tooltip("Slider")]
|
||||
public Slider targetSlider;
|
||||
|
||||
[Tooltip("Text (TMP)")]
|
||||
public TextMeshProUGUI valueDisplayText;
|
||||
|
||||
[Header("預設值")]
|
||||
public int defaultFov = 90;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (targetSlider != null)
|
||||
{
|
||||
// 與 Apex 相同的範圍
|
||||
targetSlider.minValue = 70f;
|
||||
targetSlider.maxValue = 110f;
|
||||
targetSlider.wholeNumbers = true;
|
||||
targetSlider.value = defaultFov;
|
||||
|
||||
UpdateDisplayText(targetSlider.value);
|
||||
|
||||
targetSlider.onValueChanged.AddListener(UpdateDisplayText);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateDisplayText(float val)
|
||||
{
|
||||
if (valueDisplayText != null)
|
||||
{
|
||||
valueDisplayText.text = $"FOV : {Mathf.RoundToInt(val)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user