Пример #1
0
 public virtual void Update()
 {
     if (isClient)
     {
         // Update client interactions
         for (int index = 0; index < clientInteractions.Count; index++)
         {
             ClientInteractionInstance instance = clientInteractions[index];
             if (instance.FirstTick)
             {
                 instance.FirstTick = false;
                 try
                 {
                     if (!instance.Interaction.ClientStart(instance.Event))
                     {
                         clientInteractions.RemoveAt(index);
                         index--;
                     }
                 }
                 catch (Exception)
                 {
                     clientInteractions.RemoveAt(index);
                     throw;
                 }
             }
             else
             {
                 if (!instance.Interaction.ClientUpdate(instance.Event))
                 {
                     clientInteractions.RemoveAt(index);
                     index--;
                 }
             }
         }
     }
     if (isServer)
     {
         // Update server interactions
         for (int index = 0; index < interactions.Count; index++)
         {
             InteractionInstance instance = interactions[index];
             if (instance.FirstTick)
             {
                 instance.FirstTick = false;
                 try
                 {
                     if (!instance.Interaction.Start(instance.Event, instance.Reference))
                     {
                         interactions.Remove(instance);
                         index--;
                     }
                 }
                 catch (Exception)
                 {
                     interactions.Remove(instance);
                     throw;
                 }
             }
             else
             {
                 if (!instance.Interaction.Update(instance.Event, instance.Reference))
                 {
                     interactions.Remove(instance);
                     index--;
                 }
             }
         }
     }
 }
Пример #2
0
 protected bool Equals(InteractionInstance other)
 {
     return(Equals(Reference, other.Reference));
 }