Пример #1
0
        public static T Spawn <T>() where T : class, IComponentBase, new()
        {
            var key = WorldUtilities.GetKey <T>();
            var obj = (T)PoolComponents.Spawn_INTERNAL(key);

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

            return(PoolInternalBase.Create <T>());
        }
Пример #2
0
        public static object Spawn(System.Type type)
        {
            var key      = WorldUtilities.GetKey(type);
            var instance = PoolComponents.Spawn_INTERNAL(type, key, out var pool);

            if (instance == null)
            {
                instance = (IComponent)System.Activator.CreateInstance(type);
                PoolInternalBase.CallOnSpawn(instance, pool);
            }

            return(instance);
        }
Пример #3
0
        public static object Spawn(System.Type type)
        {
            var key = WorldUtilities.GetKey(type);

            return(PoolComponents.Spawn_INTERNAL(key));
        }