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

@@ -1,7 +1,8 @@
using UnityEngine;
using UnityEngine.Events;
using System;
public class LevelManager : MonoBehaviour
public class LevelManager : MonoBehaviour, ITask
{
public static LevelManager Instance;
@@ -14,6 +15,40 @@ public class LevelManager : MonoBehaviour
private int scoredCount = 0;
// ── ITask ────────────────────────────────────────────────────────────────
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 Action<ITask> _onExit;
public void Initialize(Action<ITask> onCompleted)
{
IsCompleted = false;
_onCompleted = onCompleted;
ResetCounter();
// Wire OnAllItemsScored to Complete() if not already wired
OnAllItemsScored.AddListener(Complete);
}
public void Complete()
{
if (IsCompleted) return;
IsCompleted = true;
Debug.Log("[LevelManager] Task complete!");
_onCompleted?.Invoke(this);
ExitTask(_onExit);
}
public void ExitTask(Action<ITask> onExit)
{
onExit?.Invoke(this);
}
// ─────────────────────────────────────────────────────────────────────────
void Awake()
{
if (Instance == null) Instance = this;
@@ -39,3 +74,4 @@ public class LevelManager : MonoBehaviour
public int GetScoredCount() => scoredCount;
public int GetTotalCount() => itemsToScore;
}