示例#1
0
        //---------------------------------------------------------------------
        public T addComponent <T>() where T : IComponent, new()
        {
            string type_name = EntityMgr.getComponentName <T>();
            T      component = (T)_addComponent(type_name, null, true);

            return(component);
        }
示例#2
0
        //---------------------------------------------------------------------
        public void removeComponent(IComponent component)
        {
            if (component == null)
            {
                return;
            }

            string type_name = EntityMgr.getComponentName(component);

            removeComponent(type_name);
        }
示例#3
0
        //---------------------------------------------------------------------
        public T getComponent <T>() where T : IComponent
        {
            string type_name = EntityMgr.getComponentName <T>();

            if (mMapComponent.ContainsKey(type_name))
            {
                return((T)mMapComponent[type_name]);
            }
            else
            {
                return(default(T));
            }
        }