public void LoopStart() { if (!deleted.IsEmpty) { for (int i = 0, j = deleted.Size; j > i; i++) { Entity e = deleted.Get(i); entityManager.Remove(e); groupManager.Remove(e); e.DeletingState = false; } deleted.Clear(); } if (!refreshed.IsEmpty) { for (int i = 0, j = refreshed.Size; j > i; i++) { Entity e = refreshed.Get(i); entityManager.Refresh(e); e.RefreshingState = false; } refreshed.Clear(); } }
public Bag <Component> GetComponents(Entity e) { entityComponents.Clear(); int entityId = e.GetId(); for (int a = 0, b = componentsByType.Size(); b > a; a++) { Bag <Component> components = componentsByType.Get(a); if (components != null && entityId < components.Size()) { Component component = components.Get(entityId); if (component != null) { entityComponents.Add(component); } } } return(entityComponents); }
/// <summary> /// Get all components assigned to an entity /// </summary> /// <param name="e">Entity for which you want the components</param> /// <returns>Bag of components</returns> public Bag <Component> GetComponents(Entity e) { System.Diagnostics.Debug.Assert(e != null); entityComponents.Clear(); int entityId = e.Id; for (int a = 0, b = componentsByType.Size; b > a; a++) { Bag <Component> components = componentsByType.Get(a); if (components != null && entityId < components.Size) { Component component = components.Get(entityId); if (component != null) { entityComponents.Add(component); } } } return(entityComponents); }
public void LoopStart() { if (!refreshed.IsEmpty()) { for (int i = 0, j = refreshed.Size(); j > i; i++) { entityManager.Refresh(refreshed.Get(i)); } refreshed.Clear(); } if (!deleted.IsEmpty()) { for (int i = 0, j = deleted.Size(); j > i; i++) { Entity e = deleted.Get(i); entityManager.Remove(e); } deleted.Clear(); } }