예제 #1
0
 public void AddEventsToQueue <T>(StablePriorityQueue <GameEventPriority, EventQueueElement <T> > queue, Priority maxPriority, ref Priority nextPriority, PriorityList <T> effectList, Character targetChar) where T : GameEvent
 {
     foreach (Priority priority in effectList.GetPriorities())
     {
         //if an item has the same priority variable as the nextPriority, enqueue it
         //if an item has a higher priority variable than nextPriority, ignore it
         //if an item has a lower priority variable than nextPriority, check against maxPriority
         for (int ii = 0; ii < effectList.GetCountAtPriority(priority); ii++)
         {
             if (priority == nextPriority)
             {
                 GameEventPriority     gameEventPriority = new GameEventPriority(priority, GameEventPriority.USER_PORT_PRIORITY, GetEventCause(), GetID(), ii);
                 EventQueueElement <T> eventQueueElement = new EventQueueElement <T>(this, null, effectList.Get(priority, ii), targetChar);
                 queue.Enqueue(gameEventPriority, eventQueueElement);
             }
             else if (priority < nextPriority || nextPriority == Priority.Invalid)
             {
                 //if the item has a lower priority variable than maxPriority, ignore it
                 //if the item has a higher priority variable than maxPriority, clear the queue and add the new item
                 if (priority > maxPriority || maxPriority == Priority.Invalid)
                 {
                     nextPriority = priority;
                     queue.Clear();
                     GameEventPriority     gameEventPriority = new GameEventPriority(priority, GameEventPriority.USER_PORT_PRIORITY, GetEventCause(), GetID(), ii);
                     EventQueueElement <T> eventQueueElement = new EventQueueElement <T>(this, null, effectList.Get(priority, ii), targetChar);
                     queue.Enqueue(gameEventPriority, eventQueueElement);
                 }
             }
         }
     }
 }
예제 #2
0
 public void AddEventsToQueue <T>(StablePriorityQueue <GameEventPriority, Tuple <GameEventOwner, Character, T> > queue, Priority maxPriority, ref Priority nextPriority, PriorityList <T> effectList) where T : GameEvent
 {
     foreach (Priority priority in effectList.GetPriorities())
     {
         //if an item has the same priority variable as the nextPriority, enqueue it
         //if an item has a higher priority variable than nextPriority, ignore it
         //if an item has a lower priority variable than nextPriority, check against maxPriority
         for (int ii = 0; ii < effectList.GetCountAtPriority(priority); ii++)
         {
             if (priority == nextPriority)
             {
                 queue.Enqueue(new GameEventPriority(priority, PortPriority, Passive.GetEventCause(), Passive.GetID(), ii), new Tuple <GameEventOwner, Character, T>(Passive, EventChar, effectList.Get(priority, ii)));
             }
             else if (priority < nextPriority || nextPriority == Priority.Invalid)
             {
                 //if the item has a lower priority variable than maxPriority, ignore it
                 //if the item has an equal or higher priority variable than maxPriority, clear the queue and add the new item
                 if (priority > maxPriority || maxPriority == Priority.Invalid)
                 {
                     nextPriority = priority;
                     queue.Clear();
                     queue.Enqueue(new GameEventPriority(priority, PortPriority, Passive.GetEventCause(), Passive.GetID(), ii), new Tuple <GameEventOwner, Character, T>(Passive, EventChar, effectList.Get(priority, ii)));
                 }
             }
         }
     }
 }
예제 #3
0
 public void Clear()
 {
     queue.Clear();
 }
예제 #4
0
 public void Dispose()
 {
     _queue.Clear();
     _pool.Clear();
     _list.Clear();
 }