コード例 #1
0
        public T GetComponent <T>() where T : IRenderComponent
        {
            if (components == null)
            {
                return(default(T));
            }

            Type             type = typeof(T);
            IRenderComponent c    = components[type, type];

            return(c as T);
        }
コード例 #2
0
        public void RemoveComponent <T>() where T : IRenderComponent
        {
            if (components == null)
            {
                return;
            }
            Type             type = typeof(T);
            IRenderComponent c    = components[type, type];

            if (c != null)
            {
                c.Destroy();
                components[type, type] = null;
                tempComponents.Remove(c);
            }
        }