Esempio n. 1
0
        private static DrivenGameObjectPool getOrCreatePool(
            GameObjectComponentDescription forComponents)
        {
            DrivenGameObjectPool pool;

            if (!_pools.TryGetValue(forComponents, out pool))
            {
                _pools[forComponents] = pool = new DrivenGameObjectPool();
                pool._components      = forComponents;
            }
            return(pool);
        }
Esempio n. 2
0
        public DrivenGameObject(DrivenGameObjectPool pool)
        {
            if (pool == null)
            {
                throw new ArgumentNullException(
                          "DrivenGameObject instances must belong to a pool.");
            }

            _pool = pool;

            foreach (var componentType in pool.componentTypes)
            {
                gameObject.AddComponent(componentType);
            }
        }