예제 #1
0
        public void Initialize()
        {
            //	All dynamic objects nested in the Dynamic GO
            Transform parent = GameObject.FindGameObjectWithTag(Tags.Dynamic).transform;

            //	Player
            player = Player.Spawn(m_playerShipPrefab, parent);
            m_playerCollisionDetection = player.GetComponentInChildren <BasicCollisionDectection>();
            //m_playerCollisionDetection = player.GetComponentInChildren<PlayerCollisionDetection>();

            AddListeners();

            player.Destruction();

            //	Pool of asteroids
            PoolManager.BuildPool(m_asteroidBigPrefab, UNITS_POOL_SIZE);
            m_asteroidBigPool = PoolManager.GetPool(m_asteroidBigPrefab);

            PoolManager.BuildPool(m_asteroidSmallPrefab, UNITS_POOL_SIZE);
            m_asteroidSmallPool = PoolManager.GetPool(m_asteroidSmallPrefab);

            //m_asteroidBigPool = ObjectPool.Build(m_asteroidBigPrefab, 25);
            //m_asteroidSmallPool = ObjectPool.Build(m_asteroidSmallPrefab, 25);

            // Pool of explosions
            detonator.BuildPools(FX_POOL_SIZE);
        }
예제 #2
0
        public void BuildPools(int poolSize)
        {
            if (explosionCollection == null)
            {
                explosionCollection = new Dictionary <BaseExplosion, ObjectPool <GameObject> >();
            }

            int nExplosions = explosions.Length;

            for (int i = 0; i < nExplosions; i++)
            {
                BaseExplosion currentExplosion = explosions[i];
                PoolManager.BuildPool(currentExplosion.ParticleSysPrefab, poolSize);
                ObjectPool <GameObject> itemsPool = PoolManager.GetPool(currentExplosion.ParticleSysPrefab);
                explosionCollection[currentExplosion] = itemsPool;
            }
            //poolsBuilt = true;
        }