コード例 #1
0
 internal void AddVisible(DrawableEntity entity)
 {
     foreach (var behavior in entity.drawBehaviors)
     {
         AddToDrawBehaviorList(entity, behavior);
     }
 }
コード例 #2
0
 internal void ChangeRenderLayer(DrawableEntity entity,
                                 IEnumerable <DrawBehavior> drawBehaviors)
 {
     foreach (var behavior in drawBehaviors)
     {
         RemoveFromDrawBehaviorList(entity, behavior);
         AddToDrawBehaviorList(entity, behavior);
     }
 }
コード例 #3
0
 internal void AddToDrawBehaviorList(DrawableEntity entity, DrawBehavior drawBehavior)
 {
     if (entity.RenderLayer == DrawableEntity.DefaultRenderLayer)
     {
         unsortedDrawEntities[drawBehavior].Add(entity);
     }
     else
     {
         FindSpotOrCreateOne(entity.RenderLayer).Add(drawBehavior, entity);
     }
 }
コード例 #4
0
 private static void RemoveEntityIfInList(DrawableEntity entity,
                                          SortedDrawBehaviors sortedBehavior)
 {
     foreach (var behavior in entity.drawBehaviors)
     {
         if (sortedBehavior.behaviors.Keys.Contains(behavior))
         {
             sortedBehavior.behaviors[behavior].Remove(entity);
         }
     }
 }
コード例 #5
0
 public void Add(DrawBehavior behavior, DrawableEntity entity)
 {
     if (behaviors.ContainsKey(behavior))
     {
         behaviors[behavior].Add(entity);
     }
     else
     {
         behaviors.Add(behavior, new List <DrawableEntity> {
             entity
         });
     }
 }
コード例 #6
0
 private void CheckRenderLayerListToDeleteEntity(DrawableEntity entity)
 {
     for (int index = 0; index < negativeSortedDrawEntities.Count; index++)
     {
         RemoveEntityIfInList(entity, negativeSortedDrawEntities[index]);
     }
     for (int index = 0; index < positiveSortedDrawEntities.Count; index++)
     {
         RemoveEntityIfInList(entity, positiveSortedDrawEntities[index]);
     }
     foreach (var behavior in entity.drawBehaviors)
     {
         if (unsortedDrawEntities.Keys.Contains(behavior))
         {
             unsortedDrawEntities[behavior].Remove(entity);
         }
     }
 }
コード例 #7
0
 private void RemoveFromDrawBehaviorList(DrawableEntity entity, DrawBehavior drawBehavior)
 {
     foreach (var pair in unsortedDrawEntities.Where(pair => pair.Key == drawBehavior))
     {
         pair.Value.Remove(entity);
     }
     foreach (var drawBehaviorEntities in negativeSortedDrawEntities)
     {
         foreach (var pair in drawBehaviorEntities.behaviors.Where(pair => pair.Key == drawBehavior))
         {
             pair.Value.Remove(entity);
         }
     }
     foreach (var drawBehaviorEntities in positiveSortedDrawEntities)
     {
         foreach (var pair in drawBehaviorEntities.behaviors.Where(pair => pair.Key == drawBehavior))
         {
             pair.Value.Remove(entity);
         }
     }
 }
コード例 #8
0
 internal void RemoveVisible(DrawableEntity entity)
 {
     CheckRenderLayerListToDeleteEntity(entity);
 }