33 lines
531 B
C#
33 lines
531 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class TaskManager : MonoBehaviour
|
|
{
|
|
#region Statication
|
|
|
|
public static TaskManager instance;
|
|
|
|
private void Awake()
|
|
{
|
|
if (instance != null && instance != this)
|
|
{
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
instance = this;
|
|
}
|
|
|
|
#endregion
|
|
|
|
public List<Task> activeTasks = new();
|
|
public int maxTasksActive;
|
|
public bool AddTask(Task taskToAdd)
|
|
{
|
|
if (activeTasks.Count >= maxTasksActive)
|
|
{
|
|
return false;
|
|
}
|
|
activeTasks.Add(taskToAdd);
|
|
return true;
|
|
}
|
|
}
|