private Pop GetNewPop(Cell cell) { var pop = _popSpawner.Spawn() as Pop; if (pop != null) { pop.Setup(GameConfiguration.GetRandomColor(GameController.Instance.GameSession.Level)); pop.transform.SetParent(cell.transform); pop.transform.localPosition = Vector3.zero; return(pop); } return(null); }
public void Setup(bool isTopRow, int index, Row neighbor = null, Spawner popSpawner = null) { _side = GetNextSide(neighbor); transform.SetSiblingIndex(index); transform.localPosition = GetNextLocalPosition(isTopRow, neighbor, _side); if (isTopRow && popSpawner != null) { for (var i = 0; i < _cells.Count; i++) { var cell = _cells[i]; var pop = popSpawner.Spawn() as Pop; if (pop != null) { cell.Attach(pop); pop.Setup(GameConfiguration.GetRandomColor(GameController.Instance.GameSession.Level)); } } } }