public bool DistributeXP()
    {
        int lvlB     = playerMon.level;
        int xpToDist = enemyMon.GetXPValue();

        playerMon.IncrementExp(xpToDist);
        battleUIController.GetComponent <BattleXPBarControl>().SetXPBarSize(playerMon);
        battleDialogue.AddToMessages(string.Format("Gained {0} experience!", xpToDist));
        if (lvlB < playerMon.level)
        {
            battleDialogue.AddToMessages(string.Format("{0} advanced to level {1}!", playerMon.monName, playerMon.level));
            if (playerMon.CheckLevelMove() != null)
            {
                if (playerMon.LearnMove(playerMon.CheckLevelMove()))
                {
                    battleDialogue.AddToMessages(string.Format("{0} learned {1}!", playerMon.monName, playerMon.CheckLevelMove().moveName));
                }
                else
                {
                    battleDialogue.AddToMessages(string.Format("{0} is trying to learn {1}, but cannot learn more than 4 moves.", playerMon.monName, playerMon.CheckLevelMove().moveName));
                    battleDialogue.AddToMessages(string.Format("Select which move, if any, to replace with the new move."));
                    stateControl.AdvanceState(TurnState.MonsterLearningNewMove);
                    UpdateHPBar(playerMon);
                    return(true);
                }
            }
        }
        UpdateHPBar(playerMon);
        return(false);
    }
예제 #2
0
    public void ShowToolTip()
    {
        if (gameObject.GetComponent <Button>().IsInteractable())
        {
            tooltip = GameObject.FindGameObjectWithTag("UITooltip");
            if (tooltip != null)
            {
                Debug.Log("Destroying old tooltip");
                RemoveToolTip();
            }
            tooltip = Instantiate(Tooltip);
            tooltip.transform.SetParent(gameObject.transform, false);
            ttCont        = tooltip.GetComponent <MoveToolTipControl>();
            playerMonster = GameObject.Find("BattleController").GetComponent <BattleControl>().playerMon;
            switch (gameObject.name)
            {
            case "Move1Button":
                ttCont.SetText(playerMonster.learnedMoves[0]);
                break;

            case "Move2Button":
                ttCont.SetText(playerMonster.learnedMoves[1]);
                break;

            case "Move3Button":
                ttCont.SetText(playerMonster.learnedMoves[2]);
                break;

            case "Move4Button":
                ttCont.SetText(playerMonster.learnedMoves[3]);
                break;

            case "NewMove1Button":
                ttCont.SetText(playerMonster.learnedMoves[0]);
                break;

            case "NewMove2Button":
                ttCont.SetText(playerMonster.learnedMoves[1]);
                break;

            case "NewMove3Button":
                ttCont.SetText(playerMonster.learnedMoves[2]);
                break;

            case "NewMove4Button":
                ttCont.SetText(playerMonster.learnedMoves[3]);
                break;

            case "NewMoveButton":
                ttCont.SetText(playerMonster.CheckLevelMove());
                break;
            }
        }
    }