[Interaction] Zip up edge cases, base for interactions is now done
This commit is contained in:
@@ -17,14 +17,22 @@ public class ObjectiveStepBehaviour : MonoBehaviour
|
||||
if (interactable == null)
|
||||
interactable = GetComponent<Interactable>();
|
||||
if (interactable != null)
|
||||
interactable.Interacted += OnInteracted;
|
||||
{
|
||||
interactable.StartedInteraction += OnStartedInteraction;
|
||||
interactable.InteractionComplete += OnInteractionComplete;
|
||||
// Removed old Interacted subscription
|
||||
}
|
||||
PuzzleManager.Instance?.RegisterStepBehaviour(this);
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
if (interactable != null)
|
||||
interactable.Interacted -= OnInteracted;
|
||||
{
|
||||
interactable.StartedInteraction -= OnStartedInteraction;
|
||||
interactable.InteractionComplete -= OnInteractionComplete;
|
||||
// Removed old Interacted unsubscription
|
||||
}
|
||||
PuzzleManager.Instance?.UnregisterStepBehaviour(this);
|
||||
}
|
||||
|
||||
@@ -47,10 +55,18 @@ public class ObjectiveStepBehaviour : MonoBehaviour
|
||||
return isUnlocked;
|
||||
}
|
||||
|
||||
private void OnInteracted()
|
||||
private void OnStartedInteraction()
|
||||
{
|
||||
// Optionally handle started interaction (e.g. visual feedback)
|
||||
}
|
||||
|
||||
private void OnInteractionComplete(bool success)
|
||||
{
|
||||
if (!isUnlocked) return;
|
||||
Debug.Log($"[Puzzles] Step interacted: {stepData?.stepId} on {gameObject.name}");
|
||||
PuzzleManager.Instance?.OnStepCompleted(stepData);
|
||||
if (success)
|
||||
{
|
||||
Debug.Log($"[Puzzles] Step interacted: {stepData?.stepId} on {gameObject.name}");
|
||||
PuzzleManager.Instance?.OnStepCompleted(stepData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user