private AnimatedBackgroundCloud[] CreateClouds() { float rowHeight = _cloudFloor / Cloud_Row_Count; int lastRow = 0; Point nextCloudPosition = new Point(0, 0); float horizontalRange = Wrap ? _worldDimensions.X * 0.2f : _worldDimensions.X * 0.5f; List <AnimatedBackgroundCloud> clouds = new List <AnimatedBackgroundCloud>(); while (nextCloudPosition.X < horizontalRange) { int row = Leda.Core.Random.Generator.NextInt(Cloud_Row_Count - 1); row = row >= lastRow ? row + 1 : row; lastRow = row; nextCloudPosition.Y = (int)((row * rowHeight) + Leda.Core.Random.Generator.Next(rowHeight * 0.2f, rowHeight * 0.8f)); AnimatedBackgroundCloud cloud = new AnimatedBackgroundCloud(nextCloudPosition, _cloudScaling, _cloudTint); clouds.Add(cloud); nextCloudPosition.X += (int)(cloud.Width + (Leda.Core.Random.Generator.Next(-Cloud_Spacing_Modifier, Cloud_Spacing_Modifier) * _cloudScaling.X)); } return(clouds.ToArray()); }
private AnimatedBackgroundCloud[] CreateClouds() { float rowHeight = _cloudFloor / Cloud_Row_Count; int lastRow = 0; Point nextCloudPosition = new Point(0, 0); float horizontalRange = Wrap ? _worldDimensions.X * 0.2f : _worldDimensions.X * 0.5f; List<AnimatedBackgroundCloud> clouds = new List<AnimatedBackgroundCloud>(); while (nextCloudPosition.X < horizontalRange) { int row = Leda.Core.Random.Generator.NextInt(Cloud_Row_Count - 1); row = row >= lastRow ? row + 1 : row; lastRow = row; nextCloudPosition.Y = (int)((row * rowHeight) + Leda.Core.Random.Generator.Next(rowHeight * 0.2f, rowHeight * 0.8f)); AnimatedBackgroundCloud cloud = new AnimatedBackgroundCloud(nextCloudPosition, _cloudScaling, _cloudTint); clouds.Add(cloud); nextCloudPosition.X += (int)(cloud.Width + (Leda.Core.Random.Generator.Next(-Cloud_Spacing_Modifier, Cloud_Spacing_Modifier) * _cloudScaling.X)); } return clouds.ToArray(); }