Some conflicts resolved
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
<<<<<<< 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
|
||||
{
|
||||
@@ -9,13 +15,18 @@ public class LevelManager : MonoBehaviour, ITask
|
||||
|
||||
[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; }
|
||||
@@ -25,6 +36,47 @@ public class LevelManager : MonoBehaviour, ITask
|
||||
|
||||
public bool IsCompleted { get; private set; } = false;
|
||||
protected Action<ITask> 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<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;
|
||||
else Destroy(gameObject);
|
||||
}
|
||||
>>>>>>> origin/main
|
||||
|
||||
public void RegisterItem()
|
||||
{
|
||||
@@ -44,6 +96,7 @@ public class LevelManager : MonoBehaviour, ITask
|
||||
|
||||
public int GetScoredCount() => scoredCount;
|
||||
public int GetTotalCount() => itemsToScore;
|
||||
<<<<<<< HEAD
|
||||
|
||||
public void Initialize(Action<ITask> onCompleted)
|
||||
{
|
||||
@@ -66,3 +119,7 @@ public class LevelManager : MonoBehaviour, ITask
|
||||
OnCompleted?.Invoke(this);
|
||||
}
|
||||
}
|
||||
=======
|
||||
}
|
||||
|
||||
>>>>>>> origin/main
|
||||
|
||||
Reference in New Issue
Block a user