void Spawn_AsteroidExplosion(bool spawnBig, Vector2 position) { Poolable explosion = spawnBig ? m_BigExplosionPool.GetRecyclable() : m_SmallExplosionPool.GetRecyclable(); explosion.transform.position = position; explosion.transform.rotation = Random.rotation; }
private Asteroid SpawnAsteroidFromPool(ObjectPool pool) { Asteroid asteroid = pool.GetRecyclable <Asteroid>(); asteroid.Spawn(); return(asteroid); }
void SpawnAsteroids(int count) { for (int i = 0; i < count; i++) { ObjectPool bigOrSmall = i % 2 == 0 ? _bigAsteroidsPool : _smallAsteroidsPool; var asteroid = bigOrSmall.GetRecyclable <Asteroid>(); asteroid.Spawn(); } }
void SpawnEnemies(int count) { for (int i = 0; i < count; i++) { ObjectPool pool = EnemyPools[Random.Range(0, EnemyPools.Count - 1)]; var enemy = pool.GetRecyclable <EnemyUnit>(); enemy.Spawn(); } }