Beispiel #1
0
 public void LoadSavedGame()
 {
     if (saveLoadService.CheckExistSave())
     {
         PlayerPrefs.SetInt(Constants.NEWGAME, 0);
         sceneLoaderService.LoadScene(SceneNames.MAIN_SCENE);
     }
 }
    // Update is called once per frame
    void Update()
    {
        switch (BattleHasEnded())
        {
        case EEndBattleStatus.Ongoing:
            switch (battleStatus)
            {
            case EBattleStatus.PreparingTurn:
                PrepareTurn();
                break;

            case EBattleStatus.ActiveTurn:
                DoBattle(playerTeamTurn, enemyTeamTurn);
                break;

            case EBattleStatus.NpcAttacking:
                break;

            case EBattleStatus.EndTurn:
                PrintTurn();
                print("End of Turn: " + turn);
                turn++;
                battleStatus = EBattleStatus.PreparingTurn;
                break;
            }
            break;

        case EEndBattleStatus.PlayerWon:
            foreach (NpcBase npc in playerTeam)
            {
                npc.stats.GainExperience(enemyTeam.Count * 5);
            }
            playerDataController.Save();
            sceneLoader.LoadScene(SceneNames.MAIN_SCENE);
            print("Battle has ended!, the player Won, do something!");
            break;

        case EEndBattleStatus.PlayerLost:
            playerDataController.Save();
            sceneLoader.LoadScene(SceneNames.MAIN_SCENE);
            print("Battle has ended!, the player Lost, do something!");
            break;

        default:
            break;
        }
    }
Beispiel #3
0
        /// <inheritdoc />
        /// <summary>
        /// Global signal emitted when the game starts.
        /// </summary>
        protected override async void OnGameStart()
        {
            base.OnGameStart();

            if (!SceneManager.GetSceneByName("UIScene").isLoaded)
            {
                var scene = await _sceneLoaderService.LoadScene("UIScene", LoadSceneMode.Additive);
            }

            // AssetService.LoadAsset<CoreDemoLevel>(AssetCategoryRoot.Levels, Constants.Levels.CoreDemoLevel)
            //     .Run(level =>
            //     {
            //         Debug.Log("MyGame Started.".Colored(Colors.Fuchsia));
            //
            //         //Load CoreDemoLevel level
            //         Debug.Log(("MyGame | Level " + Constants.Levels.CoreDemoLevel + " loaded.").Colored(Colors.Fuchsia));
            //
            //         var demo = FactoryService.Instantiate(level);
            //     });
        }
    private void addRandomResources()
    {
        int quantity     = Random.Range(1, 6);
        int resourceType = Random.Range(1, 11);

        switch (resourceType)
        {
        case 1:     // water
        case 2:
        case 3:
            pDController.PlayerData.CurrentWater += quantity * 2;
            break;

        case 4:     // food
        case 5:
        case 6:
            pDController.PlayerData.CurrentFood += quantity * 2;
            break;

        case 7:     // Medicine
            pDController.PlayerData.CurrentMedicine += quantity;
            break;

        case 8:     // Gold
            pDController.PlayerData.CurrentGold += quantity * 10;
            break;

        default:
            // No encuentra nada, puede pasar.
            break;
        }

        Debug.Log("quedan: " + numberOfDebris);
        if (numberOfDebris == 0)
        {
            pDController.Save();
            SceneLoaderService sceneLoaderService = new SceneLoaderService();
            sceneLoaderService.LoadScene(SceneNames.MAIN_SCENE);
        }
    }
Beispiel #5
0
 public void LoadMainMenu()
 {
     playerDataController.Save();
     sceneLoaderService.LoadScene(SceneNames.MAIN_MENU);
 }
Beispiel #6
0
 private void UpdateApplication()
 {
     dataPersistence.SaveProgress();
     sceneLoaderService.LoadScene(campaignRepository.CurrentScenario.Id);
 }
 public void LoadScene()
 {
     Canvas.SetActive(false);
     sceneLoaderService.LoadScene(sceneName);
 }