Compare commits

...

2 Commits

Author SHA1 Message Date
d7211e62de Merge pull request 'Implemented ITask' (#17) from keyinsertminigame into KeyInsertMinigame
Reviewed-on: #17
2026-05-17 12:54:50 +02:00
2ae5d28cc9 Implemented ITask 2026-05-17 10:06:36 +02:00
2 changed files with 32 additions and 2 deletions

View File

@@ -1,13 +1,24 @@
using System;
using UnityEngine; using UnityEngine;
public class InserKeysMinigameManager : MonoBehaviour public class InserKeysMinigameManager : MonoBehaviour, ITask
{ {
public int correctIndex; public int correctIndex;
public bool isInputLocked = false; public bool isInputLocked = false;
public string TaskID { get; set; }
public TaskType TaskType { get; set; }
public string TaskName { get; set; }
public (double, double) TaskLocation { get; set; }
public bool IsCompleted { get; private set; }
private Action<ITask> _onCompleted;
private void Start() private void Start()
{ {
correctIndex = Random.Range(0, 9); correctIndex = UnityEngine.Random.Range(0, 9);
Debug.Log("The correct keyhole is: " + correctIndex); Debug.Log("The correct keyhole is: " + correctIndex);
} }
@@ -15,4 +26,22 @@ public class InserKeysMinigameManager : MonoBehaviour
{ {
return index == correctIndex; return index == correctIndex;
} }
public void Initialize(System.Action<ITask> onCompleted)
{
IsCompleted = false;
_onCompleted = onCompleted;
}
public void ExitTask(System.Action<ITask> onExit)
{
onExit.Invoke(this);
}
public void Complete()
{
IsCompleted = true;
_onCompleted?.Invoke(this);
ExitTask(null);
}
} }

View File

@@ -82,6 +82,7 @@ public class Key : MonoBehaviour
Debug.Log("You win"); Debug.Log("You win");
if (winText != null) winText.SetActive(true); if (winText != null) winText.SetActive(true);
manager.Complete();
} }
} }