Esempio n. 1
0
        /// <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;
        }
Esempio n. 2
0
        //------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------
        public void RemoveComponent(Component component)
        {
            component.Parent = null;

            this._components.Remove(component.Type);
            this.ComponentRemoved.Fire(this, component);
        }
Esempio n. 3
0
        //------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------
        public void AddComponent(Component component)
        {
            component.Parent = this;

            this._components[component.Type] = component;
            this.ComponentAdded.Fire(this, component);
        }
Esempio n. 4
0
        /// <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);
        }
Esempio n. 5
0
 //------------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------------
 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);
     }
 }
Esempio n. 6
0
 //------------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------------
 void PopComponent(Component component)
 {
     if(component.Type == Component.MeshComponent) {
         this.PopMeshComponent((MeshComponent) component);
     }else if (component.Type == Component.LightComponent) {
         this.PopLightComponent((LightComponent) component);
     }
 }