[Interaction] Zip up edge cases, base for interactions is now done

This commit is contained in:
Michal Pikulski
2025-09-04 15:01:28 +02:00
parent 05a8a5445f
commit 4215d4b437
4 changed files with 51 additions and 25 deletions

View File

@@ -12,14 +12,12 @@ public class LevelSwitch : MonoBehaviour
void Awake()
{
_isActive = true;
if (iconRenderer == null)
iconRenderer = GetComponent<SpriteRenderer>();
interactable = GetComponent<Interactable>();
if (interactable != null)
{
interactable.Interacted += OnInteracted;
interactable.StartedInteraction += OnStartedInteraction;
}
ApplySwitchData();
}
@@ -28,7 +26,7 @@ public class LevelSwitch : MonoBehaviour
{
if (interactable != null)
{
interactable.Interacted -= OnInteracted;
interactable.StartedInteraction -= OnStartedInteraction;
}
}
@@ -52,7 +50,7 @@ public class LevelSwitch : MonoBehaviour
}
}
private async void OnInteracted()
private async void OnStartedInteraction()
{
Debug.Log($"LevelSwitch.OnInteracted: Switching to level {switchData?.targetLevelSceneName}");
if (switchData != null && !string.IsNullOrEmpty(switchData.targetLevelSceneName) && _isActive)