/// <summary> /// Return true if task was removed, otherwise false if task was NOT optional and was NOT removed. /// </summary> public bool RemoveTask(int index) { DuelTask task = tasks[index]; if (task.Optional) { tasks.RemoveAt(index); OnRemovedTask(task, index); return(true); } return(false); }
/// <summary> /// Returns true if task was completed, false if current turn Duelist is still doing their task. /// </summary> public bool CompleteTask(int index, object[] args) { if (Owner == Owner.Game.CurrentDuelistTurn || !Owner.Game.CurrentDuelistTurn.TaskList.DoingTask) { DuelTask task = tasks[index]; task.CompleteTask(args); // Make sure the tasks were not cleared. if (NumberOfTasks > 0) { tasks.RemoveAt(index); OnRemovedTask(task, index); } return(true); } return(false); }
protected virtual void OnRemovedTask(DuelTask removedTask, int index) { RemovedTask?.Invoke(this, removedTask, index); }
protected virtual void OnAddedTask(DuelTask addedTask) { AddedTask?.Invoke(this, addedTask); }
public void AddTask(DuelTask task) { tasks.Add(task); OnAddedTask(task); }