Exemplo n.º 1
0
 internal void AddVisible(DrawableEntity entity)
 {
     foreach (var behavior in entity.drawBehaviors)
     {
         AddToDrawBehaviorList(entity, behavior);
     }
 }
Exemplo n.º 2
0
 internal void ChangeRenderLayer(DrawableEntity entity,
                                 IEnumerable <DrawBehavior> drawBehaviors)
 {
     foreach (var behavior in drawBehaviors)
     {
         RemoveFromDrawBehaviorList(entity, behavior);
         AddToDrawBehaviorList(entity, behavior);
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
         }
     }
 }
 public void Add(DrawBehavior behavior, DrawableEntity entity)
 {
     if (behaviors.ContainsKey(behavior))
     {
         behaviors[behavior].Add(entity);
     }
     else
     {
         behaviors.Add(behavior, new List <DrawableEntity> {
             entity
         });
     }
 }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 8
0
 internal void RemoveVisible(DrawableEntity entity)
 {
     CheckRenderLayerListToDeleteEntity(entity);
 }