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