Fix issues with disabled puzzle steps not registering with puzzle manager

This commit is contained in:
Michal Pikulski
2025-09-12 14:38:56 +02:00
parent a580a5f35a
commit cec661586e
4 changed files with 14 additions and 14 deletions

View File

@@ -142,7 +142,7 @@ public class InputManager : MonoBehaviour
Vector2 screenPos = positionAction.ReadValue<Vector2>(); Vector2 screenPos = positionAction.ReadValue<Vector2>();
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos); Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y); Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
Debug.Log($"[InputManager] HoldMove update at {worldPos2D}"); // Debug.Log($"[InputManager] HoldMove update at {worldPos2D}");
defaultConsumer?.OnHoldMove(worldPos2D); defaultConsumer?.OnHoldMove(worldPos2D);
} }
} }

View File

@@ -139,7 +139,6 @@ namespace Interactions
} }
else else
{ {
if (itemToSlot != null) if (itemToSlot != null)
{ {
DebugUIMessage.Show("I'm not sure this works.", Color.yellow); DebugUIMessage.Show("I'm not sure this works.", Color.yellow);
@@ -148,17 +147,5 @@ namespace Interactions
Interactable.BroadcastInteractionComplete(false); Interactable.BroadcastInteractionComplete(false);
} }
} }
void Update()
{
if (_currentlySlottedItemObject != null)
{
Debug.Log($"[ItemSlot] Slotted item: {_currentlySlottedItemObject.name}");
}
else
{
Debug.Log("[ItemSlot] No item slotted.");
}
}
} }
} }

View File

@@ -32,6 +32,11 @@ namespace PuzzleS
_interactable.interactionComplete.AddListener(OnInteractionComplete); _interactable.interactionComplete.AddListener(OnInteractionComplete);
} }
PuzzleManager.Instance?.RegisterStepBehaviour(this); PuzzleManager.Instance?.RegisterStepBehaviour(this);
// Check if this step was already unlocked
if (stepData != null && PuzzleManager.Instance != null && PuzzleManager.Instance.IsStepUnlocked(stepData))
{
UnlockStep();
}
} }
void OnDestroy() void OnDestroy()

View File

@@ -179,6 +179,14 @@ public class PuzzleManager : MonoBehaviour
} }
} }
/// <summary>
/// Returns whether a step is already unlocked.
/// </summary>
public bool IsStepUnlocked(PuzzleStepSO step)
{
return unlockedSteps.Contains(step);
}
void OnApplicationQuit() void OnApplicationQuit()
{ {
_isQuitting = true; _isQuitting = true;