Repaired hole minigame
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using GeoSus.Client;
|
||||
|
||||
public class LevelManager : MonoBehaviour
|
||||
public class LevelManager : MonoBehaviour, ITask
|
||||
{
|
||||
public static LevelManager Instance;
|
||||
|
||||
@@ -14,11 +16,15 @@ public class LevelManager : MonoBehaviour
|
||||
|
||||
private int scoredCount = 0;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (Instance == null) Instance = this;
|
||||
else Destroy(gameObject);
|
||||
}
|
||||
public string TaskID { get; set; }
|
||||
|
||||
public TaskType TaskType { get; set; }
|
||||
public string TaskName { get; set; }
|
||||
|
||||
public Position TaskLocation { get; set; }
|
||||
|
||||
public bool IsCompleted { get; private set; } = false;
|
||||
protected Action<ITask> OnCompleted;
|
||||
|
||||
public void RegisterItem()
|
||||
{
|
||||
@@ -38,4 +44,25 @@ public class LevelManager : MonoBehaviour
|
||||
|
||||
public int GetScoredCount() => scoredCount;
|
||||
public int GetTotalCount() => itemsToScore;
|
||||
|
||||
public void Initialize(Action<ITask> onCompleted)
|
||||
{
|
||||
OnCompleted = onCompleted;
|
||||
|
||||
IsCompleted = false;
|
||||
ResetCounter();
|
||||
}
|
||||
|
||||
public void ExitTask(Action<ITask> onExit)
|
||||
{
|
||||
onExit?.Invoke(this);
|
||||
}
|
||||
|
||||
public void Complete()
|
||||
{
|
||||
if (IsCompleted) return;
|
||||
|
||||
IsCompleted = true;
|
||||
OnCompleted?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user