Zabiju je

This commit is contained in:
2026-04-26 13:30:33 +02:00
parent 208696487e
commit 700e6bfbfc
143 changed files with 11027 additions and 1298 deletions

View File

@@ -37,6 +37,9 @@ public class DraggableKey : MonoBehaviour,
{
IsCompleted = false;
_onCompleted = onCompleted;
// Register ourselves with the manager so CheckWin can call Complete()
if (KeyminigameManager.Instance != null)
KeyminigameManager.Instance.taskRef = this;
}
public void Complete()

View File

@@ -8,6 +8,9 @@ public class KeyminigameManager : MonoBehaviour
private int correctCount = 0;
public int totalKeys = 3;
/// <summary>Set by DraggableKey.Initialize() so CheckWin can fire Complete().</summary>
[HideInInspector] public ITask taskRef;
private void Awake()
{
Instance = this;
@@ -16,15 +19,19 @@ public class KeyminigameManager : MonoBehaviour
public void CheckWin()
{
correctCount++;
Debug.Log($"Keys inserted: {correctCount}/{totalKeys}");
if (correctCount >= totalKeys)
{
Debug.Log("WIN");
Debug.Log("All keys inserted — task complete!");
taskRef?.Complete();
}
}
public void Fail()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1);
Debug.Log("Wrong slot — exiting task.");
taskRef?.ExitTask(null);
// TaskManager handles unloading; no SceneManager.LoadScene here
}
}
}