public void SetColor(Color color) { foreach (var wall in wallPool.AllItems) { wall.SetColor(color); } foreach (var pool in powerUpPool.GetPools()) { foreach (var powerUp in pool.AllItems) { powerUp.SetColor(color); } } }
public void Initialize(SectionTemplate sectionTemplate) { this.template = sectionTemplate; #if UNITY_EDITOR gameObject.name = template.name; #endif wallPool = new GameObjectPool <WallColumn>(transform, template.WallColumnPrefab, template.MaxColumnCount); powerUpPool = new ProbabilityPool <PowerUp>(transform, template.GetPrefabProbabilityPairs(), template.MaxPowerUpCount); foreach (var pool in powerUpPool.GetPools()) { foreach (var powerUp in pool.PooledItemsNonAloc) { powerUp.Initialize(pool.PoolItem); } } }