Beispiel #1
0
    //Action Panel
    private void HandleActionSelection()
    {
        if (Input.GetKeyDown(right))
        {
            if (currentAction < 3)
            {
                currentAction++;
            }
        }
        else if (Input.GetKeyDown(left))
        {
            if (currentAction > 0)
            {
                currentAction--;
            }
        }
        else if (Input.GetKeyDown(down))
        {
            if (currentAction < 2)
            {
                currentAction += 2;
            }
        }
        else if (Input.GetKeyDown(up))
        {
            if (currentAction > 1)
            {
                currentAction -= 2;
            }
        }

        playerHud.UpdateChooseAction(currentAction);

        if (Input.GetKeyDown(confirmBtn))
        {
            if (currentAction == 0)
            {
                //Battle
                state = BattleState.PlayerBattle;
                playerHud.Fight();
            }
            else if (currentAction == 1)
            {
                //Talk
                state = BattleState.ChooseTalkTarget;
            }
            else if (currentAction == 2)
            {
                //Run
                if (!eventBattle)
                {
                    StartCoroutine(RunAway());
                }
                else
                {
                    state = BattleState.Busy;
                    StartCoroutine(FailedToRun(BattleState.PlayerChoose));
                }
            }
            else if (currentAction == 3)
            {
                state = BattleState.Journal;
                playerHud.OpenJournal();
            }
        }
    }