Fix puzzle unlock issues
This commit is contained in:
@@ -590,8 +590,7 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: TestAss
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents:
|
||||
- {fileID: 4778083634590203921, guid: b5fc01af35233eb4cbeede05e50a7c34, type: 3}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
|
||||
@@ -136,7 +136,16 @@ namespace Interactions
|
||||
}
|
||||
|
||||
FollowerController?.TryPickupItem(gameObject, itemData);
|
||||
bool wasPickedUp = (combinationResult == FollowerController.CombinationResult.NotApplicable);
|
||||
|
||||
var step = GetComponent<PuzzleS.ObjectiveStepBehaviour>();
|
||||
if (step != null && !step.IsStepUnlocked())
|
||||
{
|
||||
Interactable.BroadcastInteractionComplete(false);
|
||||
return;
|
||||
}
|
||||
|
||||
bool wasPickedUp = (combinationResult == FollowerController.CombinationResult.NotApplicable
|
||||
|| combinationResult == FollowerController.CombinationResult.Unsuccessful);
|
||||
Interactable.BroadcastInteractionComplete(wasPickedUp);
|
||||
|
||||
// Update pickup state and invoke event when the item was picked up successfully
|
||||
|
||||
@@ -60,6 +60,10 @@ namespace PuzzleS
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
|
||||
Debug.Log("[MDPI] OnSceneLoaded");
|
||||
_runtimeDependencies.Clear();
|
||||
BuildRuntimeDependencies();
|
||||
UnlockInitialSteps();
|
||||
}
|
||||
@@ -74,6 +78,14 @@ namespace PuzzleS
|
||||
if (!_stepBehaviours.ContainsKey(behaviour.stepData))
|
||||
{
|
||||
_stepBehaviours.Add(behaviour.stepData, behaviour);
|
||||
_runtimeDependencies.Clear();
|
||||
foreach (var step in _stepBehaviours.Values)
|
||||
{
|
||||
step.LockStep();
|
||||
}
|
||||
_unlockedSteps.Clear();
|
||||
BuildRuntimeDependencies();
|
||||
UnlockInitialSteps();
|
||||
Debug.Log($"[Puzzles] Registered step: {behaviour.stepData.stepId} on {behaviour.gameObject.name}");
|
||||
}
|
||||
}
|
||||
@@ -196,8 +208,9 @@ namespace PuzzleS
|
||||
/// </summary>
|
||||
public bool IsStepUnlocked(PuzzleStepSO step)
|
||||
{
|
||||
BuildRuntimeDependencies();
|
||||
UnlockInitialSteps();
|
||||
// _runtimeDependencies.Clear();
|
||||
// BuildRuntimeDependencies();
|
||||
// UnlockInitialSteps();
|
||||
return _unlockedSteps.Contains(step);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user