First go around with save load system

This commit is contained in:
Michal Pikulski
2025-11-02 12:48:48 +01:00
parent 5d6d4c8ba1
commit ebca297d28
13 changed files with 1511 additions and 122 deletions

View File

@@ -24,14 +24,14 @@ namespace Levels
// Settings reference
private IInteractionSettings _interactionSettings;
private bool _isActive = true;
private bool switchActive = true;
/// <summary>
/// Unity Awake callback. Sets up icon, interactable, and event handlers.
/// </summary>
void Awake()
{
_isActive = true;
switchActive = true;
if (_iconRenderer == null)
_iconRenderer = GetComponent<SpriteRenderer>();
@@ -72,7 +72,7 @@ namespace Levels
/// </summary>
protected override void OnCharacterArrived()
{
if (switchData == null || string.IsNullOrEmpty(switchData.targetLevelSceneName) || !_isActive)
if (switchData == null || string.IsNullOrEmpty(switchData.targetLevelSceneName) || !switchActive)
return;
var menuPrefab = _interactionSettings?.LevelSwitchMenuPrefab;
@@ -92,7 +92,7 @@ namespace Levels
}
// Setup menu with data and callbacks
menu.Setup(switchData, OnLevelSelectedWrapper, OnMinigameSelected, OnMenuCancel, OnRestartSelected);
_isActive = false; // Prevent re-triggering until menu is closed
switchActive = false; // Prevent re-triggering until menu is closed
// Switch input mode to UI only
InputManager.Instance.SetInputMode(InputMode.UI);
@@ -123,7 +123,7 @@ namespace Levels
private void OnMenuCancel()
{
_isActive = true; // Allow interaction again if cancelled
switchActive = true; // Allow interaction again if cancelled
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
}
}