54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class KeyminigameManager : MonoBehaviour
|
|
{
|
|
public static KeyminigameManager Instance;
|
|
|
|
private int correctCount = 0;
|
|
public int totalKeys = 3;
|
|
|
|
<<<<<<< HEAD
|
|
=======
|
|
/// <summary>Set by DraggableKey.Initialize() so CheckWin can fire Complete().</summary>
|
|
[HideInInspector] public ITask taskRef;
|
|
|
|
>>>>>>> origin/main
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
public void CheckWin()
|
|
{
|
|
correctCount++;
|
|
<<<<<<< HEAD
|
|
|
|
if (correctCount >= totalKeys)
|
|
{
|
|
Debug.Log("WIN");
|
|
=======
|
|
Debug.Log($"Keys inserted: {correctCount}/{totalKeys}");
|
|
|
|
if (correctCount >= totalKeys)
|
|
{
|
|
Debug.Log("All keys inserted — task complete!");
|
|
taskRef?.Complete();
|
|
>>>>>>> origin/main
|
|
}
|
|
}
|
|
|
|
public void Fail()
|
|
{
|
|
<<<<<<< HEAD
|
|
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1);
|
|
}
|
|
}
|
|
=======
|
|
Debug.Log("Wrong slot — exiting task.");
|
|
taskRef?.ExitTask(null);
|
|
// TaskManager handles unloading; no SceneManager.LoadScene here
|
|
}
|
|
}
|
|
>>>>>>> origin/main
|