Пример #1
0
    IEnumerator EndBattle()
    {
        if (state == DimragStateOne.WON)
        {
            int expYield = enemyUnitOne.experience + enemyUnitTwo.experience + enemyUnitThree.experience;
            int ptYield  = enemyUnitOne.pt + enemyUnitTwo.pt + enemyUnitThree.pt;

            dialogueText.text = "The enemy dropped " + ptYield + " PT!";
            playerUnit.pt    += ptYield;

            yield return(new WaitForSeconds(2f));

            dialogueText.text = "You gained " + expYield + " experience!";

            yield return(new WaitForSeconds(2f));

            Debug.Log(playerLevel.currentExperience);

            bool didLevelUp = playerLevel.GrantExperience(expYield);

            Debug.Log(playerLevel.currentExperience);

            if (didLevelUp)
            {
                dialogueText.text    = "You leveled up!";
                playerUnit.unitLevel = playerLevel.Level;
                //passes in the information about player and enemy unit to set their hud displays
                playerHUD.SetPlayerHUD(playerUnit);
            }

            //Attack: 0
            //Defense: 1
            //Skill: 2
            //Technique: 3
            //Mobility: 4
            Debug.Log("Current Attack stat: " + playerLevel.stats[0]);
            Debug.Log("Current Defense stat: " + playerLevel.stats[1]);
            Debug.Log("Current Skill stat: " + playerLevel.stats[2]);
            Debug.Log("Current Technique stat: " + playerLevel.stats[3]);
            Debug.Log("Current Mobility stat: " + playerLevel.stats[4]);

            yield return(new WaitForSeconds(2f));

            dialogueText.text = "You won the battle!";

            //	PrefabUtility.RecordPrefabInstancePropertyModifications(playerPrefab);
        }
        else if (state == DimragStateOne.LOST)
        {
            dialogueText.text = "You were defeated.";
        }

        yield return(new WaitForSeconds(2f));

        SavePlayerData();
        SceneManager.LoadScene("Overworld");
    }