public override void ReadFromJson() { Score.Level = (int)Json["level"]; Score.Score = (int)Json["score"]; Score.Cards = new List <Card>(Json["cards"].Select(x => (string)x).Select(Card.Get)); Score.Kills = (int)Json["kills"]; Score.Gibs = (int)Json["gibs"]; Score.Splats = (int)Json["splats"]; Score.HeartsRipped = (int)Json["heartsRipped"]; Score.HeartsEaten = (int)Json["heartsEaten"]; Score.RatsHunted = (int)Json["ratsHunted"]; Score.CardsCrushed = (int)Json["cardsCrushed"]; Score.GameOverType = GameOverType.Get((string)Json["gameover"]); }
public void GameOver(GameOverType type) { if (IsGameOver) { return; } RunStats.GameOverType = type; CurrentTheme.Pitch.Set(-1, LerpHelper.QuadraticIn, 100); CurrentTheme.Volume.Set(0, LerpHelper.QuadraticIn, 100); if (RunStats.GameOverType.VictoryType != VictoryType.Win) { CurrentGameOver?.Stop(); CurrentGameOver = new MusicEffect(ThemeGameOver); CurrentGameOver.Volume.Set(0, 1, LerpHelper.QuadraticIn, 240); CurrentGameOver.Play(); } HighscoreRunFile.Flush(); //Write score to disk }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { Input = InputIterator(); SpriteLoader.Init(GraphicsDevice); Scheduler.Init(); Card.Init(); Drawable.Init(); GameOverType.Init(); Template.Init(); RenderTarget2D pixel = new RenderTarget2D(GraphicsDevice, 1, 1); GraphicsDevice.SetRenderTarget(pixel); GraphicsDevice.Clear(Color.White); GraphicsDevice.SetRenderTarget(null); Pixel = pixel; Noise = GenerateNoiseTexture(GraphicsDevice, 256, 256, new Random()); LoadFont(); if (!OptionsFile.Exists) { OptionsFile.Flush(); } else { OptionsFile.Reload(); } Scene = new SceneMascot(this); base.Initialize(); }