public virtual void AddDrawableComponent(EntityDrawableComponent component) { if (component.Parent != null) { throw new Exception("ParentComponent must be null"); } if (components.ContainsKey(component.Name)) { //TODO throw new Exception("Enity has component with same name"); } component.Parent = this; if (scene != null) { component.Initialize(); } component.DrawOrderChanged += (s, e) => isDrawDirty = true; components.Add(component.Name, component); drawableComponents.Add(component); isDrawDirty = true; }
public virtual void RemoveDrawableComponent(EntityDrawableComponent component) { component.Parent = null; components.Remove(component.Name); drawableComponents.Remove(component); }