48 lines
1.0 KiB
C#
48 lines
1.0 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class InserKeysMinigameManager : MonoBehaviour, ITask
|
|
{
|
|
public int correctIndex;
|
|
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()
|
|
{
|
|
correctIndex = UnityEngine.Random.Range(0, 9);
|
|
Debug.Log("The correct keyhole is: " + correctIndex);
|
|
}
|
|
|
|
public bool CheckKeyHole(int index)
|
|
{
|
|
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);
|
|
}
|
|
}
|