public void Activate(Color[] colors, GameManager gameManager) { running = true; vertOffset = Random.Range(0f, hackedInHeight - patternHeight); Vector2 vec = new Vector2(0, vertOffset); LevelObject currentLast = null; int colIndex = 0; foreach (Transform colObj in transform) { foreach (Transform child in colObj.transform) { LevelObject lvlObj = child.GetComponent <LevelObject> (); lvlObj.Activate(vec, colors[colIndex]); if (currentLast == null || currentLast.transform.position.x < lvlObj.transform.position.x) { currentLast = lvlObj; } } colIndex++; } if (currentLast == null) { throw new MissingComponentException("Pattern Manager couldn't find last LevelObject"); } else { currentLast.Subscribe(this); } }