示例#1
0
        public static T Spawn <T>() where T : class, IComponentBase, new()
        {
            var key = WorldUtilities.GetKey <T>();
            var obj = (T)PoolRegistries.Spawn_INTERNAL(key);

            if (obj != null)
            {
                return(obj);
            }

            return(PoolInternalBase.Create <T>());
        }
示例#2
0
        public static StructRegistryBase Spawn <T>() where T : struct, IStructComponent
        {
            var key = WorldUtilities.GetAllComponentTypeId <T>();
            var obj = (StructComponents <T>)PoolRegistries.Spawn_INTERNAL(key, out var pool);

            if (obj != null)
            {
                return(obj);
            }

            return(PoolInternalBase.Create <StructComponents <T> >(pool));
        }
示例#3
0
        public static object Spawn(System.Type type)
        {
            var key = WorldUtilities.GetKey(type);

            return(PoolRegistries.Spawn_INTERNAL(key));
        }