update
This commit is contained in:
@@ -48,6 +48,29 @@ namespace UI
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape)) ToggleSettings();
|
||||
HandleAltCursor();
|
||||
}
|
||||
|
||||
private void HandleAltCursor()
|
||||
{
|
||||
// Only handle Alt cursor when we are in game (HUD is active)
|
||||
// and Settings is NOT currently toggled on.
|
||||
var settingsData = screens.Find(s => s.screenName == "Settings");
|
||||
bool settingsActive = settingsData != null && settingsData.isActive;
|
||||
|
||||
if (_currentScreenName == "HUD" && !settingsActive)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
|
||||
{
|
||||
UnityEngine.Cursor.visible = true;
|
||||
UnityEngine.Cursor.lockState = CursorLockMode.None;
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.Cursor.visible = false;
|
||||
UnityEngine.Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowOnly(string name) => ShowScreen(name);
|
||||
|
||||
Reference in New Issue
Block a user