/// <summary> /// Removes an Entity/Component pair from the Entity System /// </summary> /// <param name="e"></param> /// <param name="component"></param> public void RemoveComponent(Entity e, BaseComponent component) { if (component != null) { if (componentStores.ContainsKey(component.GetType())) { Dictionary<Entity, BaseComponent> store = componentStores[component.GetType()]; store.Remove(e); } } }
/// <summary> /// Add a component to the Entity System /// </summary> /// <param name="e"></param> /// <param name="component"></param> public void RegisterComponent(Entity e, BaseComponent component) { if (!componentStores.ContainsKey(component.GetType())) { componentStores.Add(component.GetType(), new Dictionary<Entity, BaseComponent>()); } Dictionary<Entity, BaseComponent> store = componentStores[component.GetType()]; store.Add(e, component); }