/// <summary> /// Adds a component to the collection. If the component is not a known type /// it is ignored. /// </summary> /// <param name="component">The component to add.</param> /// <returns>If the compoent is a known type and if it was added to the collection.</returns> public Boolean AddComponent(Component component) { if (!this._knownTypes.Contains(component.Type)) return false; this._components[component.Type].Add(component); return true; }
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------ public void RemoveComponent(Component component) { component.Parent = null; this._components.Remove(component.Type); this.ComponentRemoved.Fire(this, component); }
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------ public void AddComponent(Component component) { component.Parent = this; this._components[component.Type] = component; this.ComponentAdded.Fire(this, component); }
/// <summary> /// Removes a component to the collection. If the component is not a known type /// it is ignored. /// </summary> /// <param name="component">The component to remove.</param> /// <returns>If the compoent is a known type and if it was removed from the collection.</returns> public Boolean RemoveComponent(Component component) { if (!this._knownTypes.Contains(component.Type)) return false; return this._components[component.Type].Remove(component); }
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------ void PushComponent(Component component) { /*depending on the type of meshComponent, add it to a render queue*/ if(component.Type == Component.MeshComponent) { this.PushMeshComponent((MeshComponent) component); } else if ((component.Type == Component.LightComponent)) { this.PushLightComponent((LightComponent) component); } }
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------ void PopComponent(Component component) { if(component.Type == Component.MeshComponent) { this.PopMeshComponent((MeshComponent) component); }else if (component.Type == Component.LightComponent) { this.PopLightComponent((LightComponent) component); } }