crosshair wip

This commit is contained in:
ntr committed 2023-08-01 16:32:49 +10:00
1 parent c611014b88
commit 42fcc9fe1b
35 files changed
+1328 -1688

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UIElements;
public class ControlsUI : MonoBehaviour {
[SerializeField]
ShipControls ship;
UIDocument uiDocument;
Label speed;
void OnEnable() {
Init();
}
void Init() {
uiDocument = GetComponent<UIDocument>();
speed = uiDocument.rootVisualElement.Q<Label>("speed");
}
void FixedUpdate() {
if (speed == null) {
Debug.LogWarning("no speed");
Init();
return;
}
speed.text = $"{ship.Speed():0} u/s";
}
}