public ScheduleManager ScheduleDelayedEvent(Event e, ICollection <Entity> entities, float timeInSec)
        {
            DelayedEventTask task = new DelayedEventTask(e, entities, this.engineService, (double)(Time.time + timeInSec));

            this.delayedTasks.AddLast(task);
            return(task);
        }
 private void TryUpdate(double time, DelayedEventTask task)
 {
     try
     {
         if (task.Update(time))
         {
             this.delayedTasks.Remove(task);
         }
     }
     catch
     {
         this.delayedTasks.Remove(task);
         throw;
     }
 }
        private void UpdateDelayedTasks(double time)
        {
            LinkedListNode <DelayedEventTask> next;

            for (LinkedListNode <DelayedEventTask> node = this.delayedTasks.First; node != null; node = next)
            {
                DelayedEventTask task = node.Value;
                next = node.Next;
                if (task.IsCanceled())
                {
                    this.delayedTasks.Remove(task);
                }
                else
                {
                    this.TryUpdate(time, task);
                }
            }
        }