- Add `upSpeedLabel` in UI Document. - Update `DebugUi` to handle and display upward speed values. - Introduce `UpdateUpSpeed` method for updating `upSpeedLabel` text.
56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
public class DebugUi : MonoBehaviour
|
|
{
|
|
private UIDocument _uiDocument;
|
|
|
|
private Label _label;
|
|
private Label _currentLabel;
|
|
private Label _forceMultiplierLabel;
|
|
private Label _velocityLabel;
|
|
private Label _groundedLabel;
|
|
private Label _upSpeedLabel;
|
|
|
|
private void OnEnable()
|
|
{
|
|
_uiDocument = GetComponent<UIDocument>();
|
|
_label = _uiDocument.rootVisualElement.Q<Label>("springDifferenceLabel");
|
|
_currentLabel = _uiDocument.rootVisualElement.Q<Label>("currentDifferenceLabel");
|
|
_forceMultiplierLabel = _uiDocument.rootVisualElement.Q<Label>("forceMultiplier");
|
|
_velocityLabel = _uiDocument.rootVisualElement.Q<Label>("velocityLabel");
|
|
_groundedLabel = _uiDocument.rootVisualElement.Q<Label>("groundedLabel");
|
|
_upSpeedLabel = _uiDocument.rootVisualElement.Q<Label>("upSpeedLabel");
|
|
}
|
|
|
|
public void UpdateText(string text)
|
|
{
|
|
_label.text = text;
|
|
}
|
|
|
|
public void UpdateCurrentText(string text)
|
|
{
|
|
_currentLabel.text = text;
|
|
}
|
|
|
|
public void UpdateForceMultiplier(string forceMultiplier)
|
|
{
|
|
_forceMultiplierLabel.text = forceMultiplier;
|
|
}
|
|
|
|
public void UpdateVelocity(string velocity)
|
|
{
|
|
_velocityLabel.text = velocity;
|
|
}
|
|
|
|
public void UpdateGrounded(string grounded)
|
|
{
|
|
_groundedLabel.text = grounded;
|
|
}
|
|
|
|
public void UpdateUpSpeed(string upSpeed)
|
|
{
|
|
_upSpeedLabel.text = upSpeed;
|
|
}
|
|
} |