<<<<<<< HEAD using System; using UnityEngine; using UnityEngine.Events; using GeoSus.Client; ======= using UnityEngine; using UnityEngine.Events; using System; >>>>>>> origin/main public class LevelManager : MonoBehaviour, ITask { public static LevelManager Instance; [Header("Nastavení levelu")] [Tooltip("Kolik itemů musí hráč trefit pro splnění levelu")] <<<<<<< HEAD public int itemsToScore = 2; ======= public int itemsToScore = 3; >>>>>>> origin/main [Header("Event – vyvolá se po trefení všech itemů")] public UnityEvent OnAllItemsScored; private int scoredCount = 0; <<<<<<< HEAD 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 OnCompleted; ======= // ── 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 _onCompleted; private Action _onExit; public void Initialize(Action 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 onExit) { onExit?.Invoke(this); } // ───────────────────────────────────────────────────────────────────────── void Awake() { if (Instance == null) Instance = this; else Destroy(gameObject); } >>>>>>> origin/main public void RegisterItem() { scoredCount++; Debug.Log($"Trefeno: {scoredCount} / {itemsToScore}"); if (scoredCount >= itemsToScore) { OnAllItemsScored?.Invoke(); } } public void ResetCounter() { scoredCount = 0; } public int GetScoredCount() => scoredCount; public int GetTotalCount() => itemsToScore; <<<<<<< HEAD public void Initialize(Action onCompleted) { OnCompleted = onCompleted; IsCompleted = false; ResetCounter(); } public void ExitTask(Action onExit) { onExit?.Invoke(this); } public void Complete() { if (IsCompleted) return; IsCompleted = true; OnCompleted?.Invoke(this); } } ======= } >>>>>>> origin/main