crosshair wip
This commit is contained in:
1 parent
19f26c7ca9
commit
7c6c6902c5
35 files changed
+1331
-1688
No files matched your search
@@ -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";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user