public void ChangeBackground(Background backgroundType) { this.backgroundType = backgroundType; int height = game.Window.ClientBounds.Height; int width = game.Window.ClientBounds.Width; switch (backgroundType) { case Background.grass: { backgroundSprite = new BackgroundSprite(width, height, grassTile); break; } case Background.mud: { backgroundSprite = new BackgroundSprite(width, height, mudTile); break; } case Background.none: { break; } default: { throw new ArgumentException("Unknown background!"); } } }
public LevelState(Game1 game, Sprite spriteSheet) : base(game) { this.spriteSheet = spriteSheet; font = game.Content.Load<SpriteFont>("vanligFont"); random1 = new Random(); Sprite tile = new Sprite(game.Content.Load<Texture2D>("Tiles/MudTile")); backgroundSprite = new BackgroundSprite(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height, tile); playState = PlayState.running; }