public void RemoveComponent(Entity e, ComponentType type) { int entityId = e.GetId(); Bag <Component> components = componentsByType.Get(type.GetId()); if (RemovedComponentEvent != null) { RemovedComponentEvent(e, components.Get(entityId)); } components.Set(entityId, null); e.RemoveTypeBit(type.GetBit()); }
/// <summary> /// Reemoves the given component type from the given entity /// </summary> /// <param name="e">The entity for which you want to remove the component</param> /// <param name="type">The component type you want to remove</param> internal void RemoveComponent(Entity e, ComponentType type) { System.Diagnostics.Debug.Assert(e != null); System.Diagnostics.Debug.Assert(type != null); int entityId = e.Id; Bag <Component> components = componentsByType.Get(type.Id); if (RemovedComponentEvent != null) { RemovedComponentEvent(e, components.Get(entityId)); } components.Set(entityId, null); e.RemoveTypeBit(type.Bit); }