Exemplo n.º 1
0
    public void OnActionButton(int type)
    {
        if (battleSystem.state != BattleState.PLAYERTURN)
        {
            audioManager.Play("Click");
            return;
        }
        float curEnergy = battleSystem.playerUnit.curEnergy;

        if (type == 3 && battleSystem.playerUnit.shieldsAvailable <= 0)
        {
            audioManager.Play("Click");
            return;
        }
        if (!battleSystem.playerActions.Contains(3) && battleSystem.playerUnit.TakeEnergy(type))
        {
            if (type == 3)
            {
                playerShieldsText.text = "Usos: " + (battleSystem.playerUnit.shieldsAvailable - 1);
                audioManager.Play("ShieldUp");
            }
            else if (type == 5 && battleSystem.playerActions.Count > 0)
            {
                audioManager.Play("Click");
                return;
            }
            else
            {
                audioManager.Play("Match");
            }
            battleSystem.playerActions.Add(type);
            SetActionsHUD(battleSystem.playerActions);
        }
        if (battleSystem.playerActions.Contains(5))
        {
            sliderImage.sprite = sliderPunchSprite;
            OnActionClicked(5, 0);
        }
        else
        {
            audioManager.Play("Click");
        }
        playerHUD.SetEnergy(curEnergy, battleSystem.playerUnit);
    }