Пример #1
0
        /// <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);
        }
Пример #2
0
 /// <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);
 }
Пример #3
0
 protected virtual void OnRemovedTask(DuelTask removedTask, int index)
 {
     RemovedTask?.Invoke(this, removedTask, index);
 }
Пример #4
0
 protected virtual void OnAddedTask(DuelTask addedTask)
 {
     AddedTask?.Invoke(this, addedTask);
 }
Пример #5
0
 public void AddTask(DuelTask task)
 {
     tasks.Add(task);
     OnAddedTask(task);
 }