public async Task PlayGame() { _appStateManager.CurrentState = AppState.Loading; await _gameLoader.LoadGame(new GameInfo(0, "")); _appStateManager.CurrentState = AppState.Game; }
/// <summary> /// Loads the game based on parameters. /// </summary> /// <typeparam name="TLoadSource">Source type.</typeparam> /// <param name="canLoad">Object which can load the game.</param> /// <param name="source">Source from which we can load the game.</param> /// <returns>Loaded game.</returns> public static Game Load <TLoadSource>(IGameLoader <TLoadSource> canLoad, TLoadSource source) { byte[] serializedGame = canLoad.LoadGame(source); Game game = (Game)SerializationObjectWrapper.Deserialize(serializedGame).Value; game.ReconstructOriginalGraph(); game.Refresh(); return(game); }
public IEnumerator LoadSceneTest() { var loadTask = gameLoader.LoadGame(1); yield return(loadTask.AsIEnumerator()); Assert.That(loadTask.IsCompleted && !loadTask.IsCanceled && !loadTask.IsFaulted); var gameType = loadTask.Result; Assert.That(gameType, Is.Not.Null); yield return(new WaitForSeconds(10)); }
public async Task Load() { var loadingView = (ILoadingView)(await windowNavigation.Show <ILoadingView>(CancellationToken.None)); loadingView.UpdateProgress(null); resourcesData = await resourcesDataProvider.GetData(); player.InitResources(resourcesData); currentGame = await gameLoader.LoadGame(1, CancellationToken.None); _ = windowNavigation.Hide <ILoadingView>(CancellationToken.None); }
public async Task Load(Game game) { currentGame = game; gameType = await gameLoader.LoadGame((int)currentGame.GameType); gameType.GridAdapter.Init(game.Width, game.Height); gameType.SetupCamera(); currentGameResult = new GameResult() { Score = 0, Stars = 0, WavesAlive = 0, WavesResults = new WaveResult[currentGame.Waves.Length], }; for (int i = 0; i < currentGameResult.WavesResults.Length; i++) { currentGameResult.WavesResults[i] = CreateSkippedResult(); } }
public void OnPlayButtonClick() { _gameLoader.LoadGame(_gamesList[gamesSelectionDropdown.value]); }