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); }
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); }
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; }
void Awake() { m_rb = GetComponent <Rigidbody>(); PoolManager.BuildPool(ammunitionPrefab, DEFAULT_MAX_AMMUNITION); //EnableInputControls(); }