public void CreateStartingPlatforms(List <Platform> platforms, Transform platformParent, ref int currentSegmentIndex, ref int lastSegmentIndexWithPlatform) { const int startingSegmentPlatformCount = 5; const int startingOffset = 4; int startingSegmentHeight = -startingOffset; float spaceNeededForPlatform = _platformWidth + _horizontalPlatformSpacing; float placementStartX = -spaceNeededForPlatform * (startingSegmentPlatformCount - 1) / 2; for (int i = 0; i < startingSegmentPlatformCount; ++i) { float platformPositionX = placementStartX + i * spaceNeededForPlatform; float platformPositionY = CalculateRandomPlatformPositionY(startingSegmentHeight); Platform newPlatform = _platformSpawner.CreatePlatformOfType(PlatformType.Static, new Vector3(platformPositionX, platformPositionY, 0f), platformParent); newPlatform.SetIsDestructible(false); platforms.Add(newPlatform); } lastSegmentIndexWithPlatform = startingSegmentHeight; currentSegmentIndex = startingSegmentHeight + _maxSegmentsWithoutPlatform + 1; }