Ejemplo n.º 1
0
    private void UpdateUIStats()
    {
        for (int i = 0; i < playerNames.Count; i++)
        {
            if (i < activeUnits.Count)
            {
                if (activeUnits[i].GetIsPlayer())
                {
                    BattleUnits playerData = activeUnits[i];

                    playerNames[i].gameObject.SetActive(true);
                    playerNames[i].text = playerData.GetUnitName();
                    playerHP[i].text    = Mathf.Clamp(playerData.GetCurrHP(), 0, int.MaxValue) + "/" + playerData.GetMaxHP();
                    playerMP[i].text    = Mathf.Clamp(playerData.GetCurrMP(), 0, int.MaxValue) + "/" + playerData.GetMaxMP();
                }

                else
                {
                    playerNames[i].gameObject.SetActive(false);
                }
            }

            else
            {
                playerNames[i].gameObject.SetActive(false);
            }
        }
    }
Ejemplo n.º 2
0
    public void Magic()
    {
        BattleUnits unit = FindObjectOfType <BattleManager>().GetCurrentActiveUnit();

        if (unit.GetCurrMP() >= spellCost)
        {
            FindObjectOfType <BattleManager>().CloseMagicMenu();
            FindObjectOfType <BattleManager>().OpenEnemyTargetMenu(spellName);
            unit.SetCurrMP(unit.GetCurrMP() - spellCost);
        }
        else
        {
            // Let player know there isn't enough MP
            FindObjectOfType <BattleManager>().GetBattleNotification().SetNotificationText("Not Enough MP!");
            FindObjectOfType <BattleManager>().GetBattleNotification().Activate();
            FindObjectOfType <BattleManager>().CloseMagicMenu();
        }
    }
Ejemplo n.º 3
0
    IEnumerator BattleVictory()
    {
        DeactivateBattle();
        yield return(new WaitForSecondsRealtime(0.5f));

        FindObjectOfType <UIManager>().ActivateTransitionScreen(true);
        FindObjectOfType <UIFadeTransition>().StartFadingToBlack();
        yield return(new WaitForSecondsRealtime(1.5f));

        for (int i = 0; i < activeUnits.Count; i++)
        {
            if (activeUnits[i].GetIsPlayer())
            {
                BattleUnits player = activeUnits[i];
                GameManager gm     = FindObjectOfType <GameManager>();

                for (int j = 0; j < gm.GetStatsList().Length; j++)
                {
                    if (player.GetUnitName().ToUpper().Equals(gm.GetStatsList()[j].GetCharName().ToUpper()))
                    {
                        gm.GetStatsList()[j].SetCurrentHP(player.GetCurrHP());
                        gm.GetStatsList()[j].SetCurrentMP(player.GetCurrMP());
                    }
                }
            }
        }
        if (battleFleeing)
        {
            FindObjectOfType <GameManager>().SetBattleActive(false);
        }
        else
        {
            // Open rewards screen
            FindObjectOfType <UIManager>().ActivateRewardsScreen(true);
            FindObjectOfType <BattleResults>().OpenRewardsScreen(rewardEXP, rewardItems, shouldCompleteQuest, questToComplete);
        }

        BattleCleanUp();
        FindObjectOfType <AudioManager>().PlayBGM(FindObjectOfType <CameraController>().GetAudioToPlay());
        FindObjectOfType <UIFadeTransition>().StartFadingFromBlack();
        yield return(new WaitForSecondsRealtime(2f));

        FindObjectOfType <UIManager>().ActivateTransitionScreen(false);
    }