/// <summary> /// Initializes a new instance of the <see cref="MemoryGame" /> class. /// </summary> /// <param name="scoreCalculation">Score calculation provider.</param> /// <param name="highscoreProvider">The high score provider.</param> public MemoryGame(IScoreCalculation scoreCalculation, IHighscoreProvider highscoreProvider) { this.scoreCalculation = scoreCalculation; this.highscoreProvider = highscoreProvider; StartNewGame(); }
public void Stop() { if (this.gameStarted) { this.gameStarted = false; CompositionTarget.Rendering -= this.RenderingHandler; if (this.IsGameOver()) { IHighscoreProvider highscoreProvider = ApplicationContext.Instance.HighscoreProvider; highscoreProvider.AddHighscoreEntry(this.Player); highscoreProvider.Persist(); } } }
private void Awake() { MemoryGame.Current.IsBusy = true; numberOfPlayers = MemoryGame.Current.Players; bool isSinglePlayer = numberOfPlayers == 1; SinglePlayerContainer.SetActive(isSinglePlayer); TwoPlayerContainer.SetActive(!isSinglePlayer); string gameMode = MemoryGame.Current.GetGameModeString(); IHighscoreProvider highscoreProvider = MiscFactory.GetHighscoreProvider(); Highscore = highscoreProvider.GetHighScore(gameMode); //Highscore = 777; }