private BackgroundObject placeOnRandomLayer(BackgroundObject bgObject) { // Layer 1 is the foremost, layer 3 is the furthest away int randomLayer = RandomHandler.GetRandomInt(1, 3); bgObject.Speed = 4 - randomLayer; float yPos = yCreationPos[3 - randomLayer], layerDepth = 1f; bgObject.Move(xCreationPos, yPos); switch (randomLayer) { case 1: layerDepth = 0.1f; break; case 2: layerDepth = 0.3f; break; case 3: layerDepth = 0.9f; break; } bgObject.LayerDepth = layerDepth + RandomHandler.GetRandomFloat(0.001f); //bgObject.ScaleFactor = scaleValues[randomLayer - 1]; /*float scaleFactor = 0f; switch (randomLayer) { case 1: scaleFactor = 0.75f; break; case 2: scaleFactor = 1f; break; case 3: scaleFactor = 1.25f; break; }*/ bgObject.ScaleToTheBeat = scaleValues[randomLayer - 1]; return bgObject; }
private void createFog() { for (int i = 0; i < 3; i++) { fog = new BackgroundObject(); fog.Texture = fogTextures[0]; fog.Width = fog.Texture.Width; fog.Height = Controller.TOTAL_HEIGHT; fog.Color = Color.White; fog.Active = true; float layerDepth = 0f; switch (i) { case 0: layerDepth = 0.19f; break; case 1: layerDepth = 0.59f; break; case 2: layerDepth = 0.99f; break; } fog.LayerDepth = layerDepth; fog.Speed = 0f; fog.ScaleFactor = 1f; fog.IsFog = true; fog.Move(0, 0); bgSprites.Add(fog); } }