menu
This commit is contained in:
1 parent
45fc3026b4
commit
7dc0a04856
15 files changed
+339
-125
No files matched your search
@@ -3,7 +3,6 @@ using UnityEngine.UIElements;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
[SerializeField]
|
||||
UIDocument menuDoc;
|
||||
|
||||
[SerializeField]
|
||||
@@ -12,27 +11,43 @@ public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
[SerializeField]
|
||||
ShipControls shipControls;
|
||||
|
||||
MenuUi menuUi;
|
||||
|
||||
SpaceRaceInput input;
|
||||
bool visible = false;
|
||||
|
||||
void Start() {
|
||||
void Awake() {
|
||||
menuDoc = GetComponent<UIDocument>();
|
||||
|
||||
if (input == null) {
|
||||
input = new SpaceRaceInput();
|
||||
input.menu.SetCallbacks(this);
|
||||
}
|
||||
input.menu.Enable();
|
||||
|
||||
menuUi = GetComponent<MenuUi>();
|
||||
if (!menuUi) {
|
||||
Debug.LogError("No MenuUI");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Hide();
|
||||
}
|
||||
|
||||
void OnDestroy() {
|
||||
input.menu.RemoveCallbacks(this);
|
||||
}
|
||||
|
||||
void Show() {
|
||||
visible = true;
|
||||
UnityEngine.Cursor.lockState = CursorLockMode.None;
|
||||
menuDoc.enabled = true;
|
||||
menuUi.AddTracks();
|
||||
|
||||
// take control off the ship
|
||||
timingDoc.enabled = false;
|
||||
shipControls.enabled = false;
|
||||
|
||||
}
|
||||
|
||||
void Hide() {
|
||||
|
||||
Reference in new issue
Block a user