public void LoadComponent(GameComponent component) { GameComponent = component; var componentControl = Activator.CreateInstance(_gameObjectDialogTypes[component.GetType()]) as ComponentControl; componentControl.Component = component; lblComponentName.Text = component.GetType().Name; contentPanel.Controls.Add(componentControl); }
public void RemoveComponent(GameComponent component) { _components.Remove(component); component.Dispose(); OnComponentRemovedEvent(this, new ComponentRemovedEvent() { Component = component }); _compositionChanged = true; }
public void AddComponent(GameComponent component) { if (component.IsLoaded) throw new InvalidOperationException("Component cannot be loaded"); component.GameObject = this; _components.Add(component); if (IsLoaded) { /* load all not yet loaded components (when dependencies were not met) */ _components.ForEach(gc => { if (!gc.IsLoaded) gc.Load(); }); } OnComponentAddedEvent(this, new ComponentAddedEvent() { Component = component }); _compositionChanged = true; }
public void AddComponent(GameComponent component) { _components.Add(component); }