示例#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);
 }