Files
pogo-stick-game/Assets/DebugUi.cs
ondroftw 04d419d6aa Add Debug UI integration and update TestScript interaction logic
- Implement `DebugUi` component for updating and displaying debug information.
- Configure new UI Toolkit assets, including `PanelSettings` and `UIDocument`.
- Update TestScript to support dynamic ForceMode, velocity, and difference tracking with debug UI.
- Minor adjustments to Rigidbody torque and interaction parameters.
2025-10-11 00:41:23 +02:00

42 lines
1.1 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 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");
}
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;
}
}