Exemplo n.º 1
0
    public void playerSelect(int moveNum)
    {
        // Reset error text on make selection
        btext.updateErrorText(" ");

        // alter doMove() so also can recieve player and enemy objects
        // and react based on whose turn it is

        if (moveset.getMoveSetCost(moveNum) > player.SP)
        {
            Debug.Log("you cannot afford this move w/current SP!");
            btext.updateErrorText("NOT ENOUGH SP!");
        }
        else
        {
            // Disable player Buttons!!!!!!!!!!!

            moveset.doMove(moveNum);

            // DOES THE SELECTED ACTION WOO

            // do yield playerturn
            // after done all the stuff; set Playerturn to falso
        }
    }
    // ------------------------------------------------------------------------------------------------- //

    public void playerSelect(int moveNum)
    {
        bool PlayerMiss;
        int  attemptMove = moveNum;

        // Reset error text on make selection
        btext.updateErrorText(" ");

        // Get miss chance, can't miss on Counter
        if (enemy.prevMove == 9 && moveNum == 0)
        {
            PlayerMiss = false;
        }
        else if (moveNum == 1 || moveNum == 6 || moveNum == 7 || moveNum == 10 || moveNum == 11)
        {
            PlayerMiss = false;
        }
        else
        {
            // Get if player misses or not
            PlayerMiss = (Random.Range(0.0f, 1.0f) < enemy.EVA) ? true : false;
        }

        if (PlayerMiss)
        {
            moveNum = 9; // Change move to miss
        }

        // Stop selection if player does not have enough SP
        if (moveset.getMoveSetCost(moveNum) > player.SP)
        {
            Debug.Log("you cannot afford this move w/current SP!");
            btext.updateErrorText("NOT ENOUGH SP!");
        }
        else // continue with player selection
        {
            // Deselect button
            EventSystem.current.SetSelectedGameObject(null);

            // Disable player Buttons
            standardAbilButton.SetActive(false);
            counterButton.SetActive(false);
            sundayButton.SetActive(false);
            butterButton.SetActive(false);

            // DOES THE SELECTED ACTION WOO
            moveset.doMove(moveNum);

            // Hold the turn until the animations are over.
            StartCoroutine(RunPlayerTurnAnimations(attemptMove, moveNum));
        }
    }