Rework interactables into a flatter hierarchy, reenable puzzles as well

This commit is contained in:
Michal Pikulski
2025-09-11 13:00:26 +02:00
parent 3a40d1a151
commit e1ff13db30
32 changed files with 981 additions and 1018 deletions

View File

@@ -1,4 +1,6 @@
using System;
using Input;
using Interactions;
using UnityEngine;
/// <summary>
@@ -26,7 +28,7 @@ public class LevelSwitch : MonoBehaviour
_interactable = GetComponent<Interactable>();
if (_interactable != null)
{
_interactable.StartedInteraction += OnStartedInteraction;
_interactable.characterArrived.AddListener(OnCharacterArrived);
}
ApplySwitchData();
}
@@ -38,7 +40,7 @@ public class LevelSwitch : MonoBehaviour
{
if (_interactable != null)
{
_interactable.StartedInteraction -= OnStartedInteraction;
_interactable.characterArrived.RemoveListener(OnCharacterArrived);
}
}
@@ -71,7 +73,7 @@ public class LevelSwitch : MonoBehaviour
/// <summary>
/// Handles the start of an interaction (shows confirmation menu and switches the level if confirmed).
/// </summary>
private void OnStartedInteraction()
private void OnCharacterArrived()
{
if (switchData == null || string.IsNullOrEmpty(switchData.targetLevelSceneName) || !_isActive)
return;