Extend DebugUi to display upward speed
- Add `upSpeedLabel` in UI Document. - Update `DebugUi` to handle and display upward speed values. - Introduce `UpdateUpSpeed` method for updating `upSpeedLabel` text.
This commit is contained in:
@@ -11,6 +11,7 @@ public class DebugUi : MonoBehaviour
|
||||
private Label _forceMultiplierLabel;
|
||||
private Label _velocityLabel;
|
||||
private Label _groundedLabel;
|
||||
private Label _upSpeedLabel;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
@@ -20,6 +21,7 @@ public class DebugUi : MonoBehaviour
|
||||
_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)
|
||||
@@ -46,4 +48,9 @@ public class DebugUi : MonoBehaviour
|
||||
{
|
||||
_groundedLabel.text = grounded;
|
||||
}
|
||||
|
||||
public void UpdateUpSpeed(string upSpeed)
|
||||
{
|
||||
_upSpeedLabel.text = upSpeed;
|
||||
}
|
||||
}
|
||||
@@ -20,5 +20,9 @@
|
||||
<ui:Label text="Grounded:" style="justify-content: center;" />
|
||||
<ui:Label text="Label" name="groundedLabel" style="justify-content: center;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement style="flex-grow: 0; flex-direction: row;">
|
||||
<ui:Label text="Up speed:" style="justify-content: center;" />
|
||||
<ui:Label text="Label" name="upSpeedLabel" style="justify-content: center;" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
||||
Reference in New Issue
Block a user