/// <summary> /// Loads the game state and starts the game. /// </summary> /// <param name="state">The object stroing the state of the game.</param> public void Load(GameState state) { _movementChecker = GameMovementCheckerFactory.Instance.CreateUpdateChecker(_gameBoard); Points = state?.Points ?? 0; Difficulty = state?.Difficulty ?? 1; Lifes = state?.Lifes ?? 3; Timer = _builder.BuildTimer(state); _player = _gameBoard.Children.OfType <Player>().Single(); _player.Moved += OnPlayerMoved; _player.Direction = state?.PlayerDirection ?? Direction.Left; LoadCoinsPositions(); ConfigureEnemies(); SetCoinsColleted(); ConfigureLifesGeneratior(); }