FN_TaskManager
FN_TaskManager keeps the shift’s task list and current task. It starts tasks and updates the task UI when the current task changes.
Starting and advancing tasks
public void AdvanceToNextTask()
{
if (i_currentTaskIndex + 1 < lst_allTasks.Count)
{
i_currentTaskIndex++;
SetCurrentTask(lst_allTasks[i_currentTaskIndex]);
}
else
{
Debug.Log("Shift Complete");
}
}
public void SetCurrentTask(FN_Task newTask)
{
fn_currentTask = newTask;
fn_currentTask.BeginTask();
UpdateTaskUI();
}
AdvanceToNextTask() selects the next entry if one remains. SetCurrentTask() starts it and refreshes the task UI.
Task state
public List<FN_Task> lst_allTasks;
public FN_Task fn_currentTask;
public int i_currentTaskIndex = 0;
public TextMeshProUGUI txt_tasksLabel;
The manager stores the shift list, current task, index and task-label reference.