Sequence complete after cleanup

This commit is contained in:
Michal Pikulski
2025-11-02 10:30:59 +01:00
parent 9826dd1aa2
commit 803d649119
7 changed files with 478893 additions and 32 deletions

View File

@@ -16,14 +16,13 @@ namespace Levels
/// <summary>
/// Handles switching into minigame levels when interacted with. Applies switch data and triggers scene transitions.
/// </summary>
public class MinigameSwitch : MonoBehaviour
public class MinigameSwitch : InteractableBase
{
/// <summary>
/// Data for this level switch (target scene, icon, etc).
/// </summary>
public LevelSwitchData switchData;
private SpriteRenderer _iconRenderer;
private InteractableBase _interactable;
// Settings reference
private IInteractionSettings _interactionSettings;
@@ -41,11 +40,7 @@ namespace Levels
_isActive = true;
if (_iconRenderer == null)
_iconRenderer = GetComponent<SpriteRenderer>();
_interactable = GetComponent<InteractableBase>();
if (_interactable != null)
{
_interactable.characterArrived.AddListener(OnCharacterArrived);
}
// Initialize settings reference
_interactionSettings = GameManager.GetSettingsObject<IInteractionSettings>();
ApplySwitchData();
@@ -66,11 +61,6 @@ namespace Levels
private void OnDestroy()
{
PuzzleManager.Instance.OnAllPuzzlesComplete -= HandleAllPuzzlesComplete;
if (_interactable != null)
{
_interactable.characterArrived.RemoveListener(OnCharacterArrived);
}
if (SaveLoadManager.Instance != null)
{
SaveLoadManager.Instance.OnLoadCompleted -= OnSaveDataLoadedHandler;
@@ -142,7 +132,7 @@ namespace Levels
/// <summary>
/// Handles the start of an interaction (shows confirmation menu and switches the level if confirmed).
/// </summary>
private void OnCharacterArrived()
protected override void OnCharacterArrived()
{
if (switchData == null || string.IsNullOrEmpty(switchData.targetLevelSceneName) || !_isActive)
return;