private void GenerateNewMarkers() { treeGrid.UpdateGrid(); animationLock.Inc(); currentHeight = height * gridSpacing - 1; gridHeight = height - 1; Formation formation = formationsList [Random.Range(0, formationsList.Length)]; TreeControl.TreeColor[] dropColors = formation.GetColors(); Vector2 center = new Vector2(0, currentHeight); for (int i = 0; i < dropColors.Length; i++) { if (dropColors[i] != TreeControl.TreeColor.NONE) { int gridX = i - Mathf.FloorToInt(.5f * dropColors.Length); Vector2 position = center + Vector2.right * gridSpacing * gridX; GameObject marker = Instantiate(colorsToMarkers[dropColors[i]], position, Quaternion.identity); markers[marker] = new Vector2(gridX + width / 2, gridHeight); animationLock.Inc(); } } lastDropTime = Time.time; treeGrid.DelayedRemove(); }