internal void AddVisible(DrawableEntity entity) { foreach (var behavior in entity.drawBehaviors) { AddToDrawBehaviorList(entity, behavior); } }
internal void ChangeRenderLayer(DrawableEntity entity, IEnumerable <DrawBehavior> drawBehaviors) { foreach (var behavior in drawBehaviors) { RemoveFromDrawBehaviorList(entity, behavior); AddToDrawBehaviorList(entity, behavior); } }
internal void AddToDrawBehaviorList(DrawableEntity entity, DrawBehavior drawBehavior) { if (entity.RenderLayer == DrawableEntity.DefaultRenderLayer) { unsortedDrawEntities[drawBehavior].Add(entity); } else { FindSpotOrCreateOne(entity.RenderLayer).Add(drawBehavior, entity); } }
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 }); } }
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); } } }
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); } } }
internal void RemoveVisible(DrawableEntity entity) { CheckRenderLayerListToDeleteEntity(entity); }