Project Restructure (PLEASE UPDATE AFTER COMMIT)

This commit is contained in:
RochesterX
2025-01-15 15:05:04 -05:00
parent 63775c5103
commit dc61c3c1d0
168 changed files with 82 additions and 10 deletions

View File

@@ -0,0 +1,46 @@
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class HubManager : MonoBehaviour
{
public GameObject gameButtonsParent;
public void LoadScene(string sceneName)
{
UnloadGameScene();
SceneManager.LoadScene(sceneName, LoadSceneMode.Additive);
}
public void UnloadGameScene()
{
try
{
SceneManager.UnloadSceneAsync(SceneManager.GetSceneAt(1));
}
catch
{
Debug.Log("No game scene to unload");
}
ChangeGameButtonsInteractability(false);
}
private void Update()
{
if (InputSystem.GetDevice<Keyboard>().escapeKey.wasPressedThisFrame)
{
UnloadGameScene();
ChangeGameButtonsInteractability(true);
}
}
private void ChangeGameButtonsInteractability(bool interactable)
{
foreach (Transform button in gameButtonsParent.transform)
{
button.GetComponent<Button>().interactable = interactable;
}
}
}