boost bar and cds
This commit is contained in:
1 parent
a5ecc6374c
commit
27d3540995
7 files changed
+141
-18
No files matched your search
@@ -5,6 +5,8 @@ using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
using BoostComponents;
|
||||
|
||||
public class ControlsUI : MonoBehaviour {
|
||||
[SerializeField]
|
||||
ShipControls ship;
|
||||
@@ -12,12 +14,13 @@ public class ControlsUI : MonoBehaviour {
|
||||
UIDocument uiDocument;
|
||||
Label speed;
|
||||
Label shields;
|
||||
Label boosts;
|
||||
Label puAccel;
|
||||
Label puDecel;
|
||||
Label puStrafe;
|
||||
Label puShield;
|
||||
|
||||
BoostBar boostBar;
|
||||
|
||||
void OnEnable() {
|
||||
Init();
|
||||
}
|
||||
@@ -28,11 +31,12 @@ public class ControlsUI : MonoBehaviour {
|
||||
shields = uiDocument.rootVisualElement.Q<Label>("shields");
|
||||
|
||||
// PowerUnit
|
||||
boosts = uiDocument.rootVisualElement.Q<Label>("boosts");
|
||||
puAccel = uiDocument.rootVisualElement.Q<Label>("puAccel");
|
||||
puDecel = uiDocument.rootVisualElement.Q<Label>("puDecel");
|
||||
puStrafe = uiDocument.rootVisualElement.Q<Label>("puStrafe");
|
||||
puShield = uiDocument.rootVisualElement.Q<Label>("puShield");
|
||||
|
||||
boostBar = uiDocument.rootVisualElement.Q<BoostBar>("boostBar");
|
||||
}
|
||||
|
||||
void FixedUpdate() {
|
||||
@@ -45,10 +49,12 @@ public class ControlsUI : MonoBehaviour {
|
||||
speed.text = $"{ship.Speed():0}";
|
||||
shields.text = ship.powerUnit.ShieldPct;
|
||||
|
||||
boosts.text = ship.powerUnit.BoostAvailable;
|
||||
puAccel.text = ship.powerUnit.Acceleration.ToString();
|
||||
puDecel.text = ship.powerUnit.Deceleration.ToString();
|
||||
puStrafe.text = ship.powerUnit.Strafing.ToString();
|
||||
puShield.text = ship.powerUnit.ShieldMax.ToString();
|
||||
|
||||
boostBar.progress = ship.powerUnit.BoostProgress;
|
||||
boostBar.charges = ship.powerUnit.BoostCharges;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user