Esempio n. 1
0
 /// <summary>
 /// Sets the schedulable events to the ones specified by the given EventCollection.
 /// </summary>
 public void Set(EventCollection collection)
 {
     allEvents.Clear();
     IEnumerable<EventSignature> allSignatures = EventLibrary.Instance.GetSignatures().
         Where((EventSignature sig) => !sig.AffectsWorldState());
     //For each signature, check if it is used in the scheduler and set the values according to this.
     foreach(EventSignature signature in allSignatures)
     {
         if (collection.Any((SchedulableEvent evnt) => evnt.Signature == signature))
         {
             SchedulableEvent evnt = collection.First((SchedulableEvent e) => e.Signature == signature);
             allEvents.Add(new SchedulerEventArguments(signature, evnt.Probability, true));
         }
         else
         {
             allEvents.Add(new SchedulerEventArguments(signature, 0.0f, false));
         }
     }
     this.timeBetweenUpdates = collection.TimeBetweenUpdates.ToString();
     this.name = collection.Name;
 }