コード例 #1
0
ファイル: EventQueue.cs プロジェクト: Zazcallabah/Sysmod
        /// <summary>
        /// Removes the next event from the event queue and runs it.
        /// </summary>
        /// <returns>The time at which the event happened.</returns>
        public uint PerformNextEvent()
        {
            // take first event from queue
            IEvent first = _innerQueue.Values.First();

            _innerQueue.RemoveAt(0);

            // perform event
            first.Action();

            return(first.TriggerTime);
        }
コード例 #2
0
 public static void CreateEvent()
 {
     if (IsAnyEventRunning)
     {
         Logger.LogTrivial(typeof(EventPool).Name, "Another event running. Aborting new event...");
         return;
     }
     GameFiber.StartNew(delegate
     {
         IEvent ambientEvent = GetRandomEvent();
         currentEvent        = ambientEvent;
         if (ambientEvent.CanBeSpawned)
         {
             if (ambientEvent.Create())
             {
                 ambientEvent.Action();
             }
         }
     });
 }