Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        void Awake()
        {
            //	Ensure prefabs are set
            Assert.IsNotNull(ammunitionPrefab, "[EnemyShooter] ammunitionPrefab must be referenced in the inspector!");

            m_rb = GetComponent <Rigidbody>();
            PoolManager.BuildPool(ammunitionPrefab, DEFAULT_AMMU_POOLED);
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
 void Awake()
 {
     m_rb = GetComponent <Rigidbody>();
     PoolManager.BuildPool(ammunitionPrefab, DEFAULT_MAX_AMMUNITION);
     //EnableInputControls();
 }