startUI告一段落
This commit is contained in:
1 parent
f8154f92b3
commit
da28b62f7f
34 files changed
+17562
-8231
No files matched your search
@@ -8,7 +8,12 @@ public class Movement : MonoBehaviour
|
||||
[Tooltip("Text (TMP)")]
|
||||
public TextMeshProUGUI movementVectorText;
|
||||
private Vector2 smoothedDelta = Vector2.zero;
|
||||
private const float alpha = 0.1f; // 數值越大 越貼最新數值
|
||||
private const float alpha = 0.1f;
|
||||
|
||||
[Header("顯示")]
|
||||
[Tooltip("文字更新間隔 (秒),計算仍然每幀進行")]
|
||||
public float updateInterval = 0.5f;
|
||||
private float displayTimer = 0f;
|
||||
|
||||
void Update()
|
||||
{
|
||||
@@ -30,6 +35,10 @@ public class Movement : MonoBehaviour
|
||||
smoothedDelta = Vector2.zero;
|
||||
}
|
||||
|
||||
displayTimer += Time.unscaledDeltaTime;
|
||||
if (displayTimer < updateInterval) return;
|
||||
displayTimer = 0f;
|
||||
|
||||
if (movementVectorText != null)
|
||||
{
|
||||
string xStr = (smoothedDelta.x >= 0 ? "+" : "") + smoothedDelta.x.ToString("F1");
|
||||
|
||||
Reference in new issue
Block a user