示例#1
0
        public virtual void AddComponent(PulsarComponent component)
        {
            if (component != null)
            {
                // make sure this component does not already exist in the list
                var existingEntity = _components.Find(entity => entity.Equals(component));

                if (existingEntity == null)
                {
                    IBaseEntity baseEntity = (IBaseEntity)component;
                    if (baseEntity != null)
                    {
                        baseEntity.SetDebugRenderer(_debugRenderer);
                        baseEntity.SetInDesign(InDesign);
                        baseEntity.SetNode(_node);
                        baseEntity.SetScene(_scene);
                        baseEntity.SetBaseEntity(this);
                    }
                    _node.AddComponent(component);
                    _components.Add(component);
                }
            }
        }