コード例 #1
0
ファイル: BaseSystem.cs プロジェクト: glindblom/Fishworks.ECS
 /// <summary>
 /// Virtual method invoked by the world when an entity has been removed from the world.
 /// </summary>
 /// <param name="sender">The world.</param>
 /// <param name="eventArgs">The <see cref="EntityEventArgs"/> object containing the entity's ID and bitmask.</param>
 public virtual void OnEntityRemoved(object sender, EntityEventArgs eventArgs)
 {
     if ((SystemBitmask & eventArgs.EntityBitmask) == SystemBitmask)
     {
         if (processing)
         {
             entitiesToRemove.Add(eventArgs.EntityId);
             return;
         }
         Compositions.Remove(eventArgs.EntityId);
     }
 }
コード例 #2
0
ファイル: BaseSystem.cs プロジェクト: glindblom/Fishworks.ECS
 /// <summary>
 /// Virtual method invoked by the world when an entity has been added to the world.
 /// </summary>
 /// <param name="sender">The world.</param>
 /// <param name="eventArgs">The <see cref="EntityEventArgs"/> object containing the entity's ID and bitmask.</param>
 public virtual void OnEntityAdded(object sender, EntityEventArgs eventArgs)
 {
     if ((SystemBitmask & eventArgs.EntityBitmask) == SystemBitmask)
     {
         if (processing)
         {
             entitiesToAdd.Add(CreateComposition(eventArgs.EntityId));
             return;
         }
         Compositions.Add(eventArgs.EntityId, CreateComposition(eventArgs.EntityId));
     }
 }