Ejemplo n.º 1
0
    public void showStage(ActiveQuest activeQuest)
    {
        clearGameObjectArray(cardsToShow);
        clearGameObjectArray(currButtons);
        if (activeQuest.getQuest() == null)
        {
            gm.setUserInputState(state.STANDBY);
            clearGameObjectArray(cardsToShow);
        }


        changeHeaderMessage(activePlayer.getName() + "'s turn", headerCurrPlayer);
        if (Object.ReferenceEquals(activeQuest.getCurrentStage().GetType(), typeof(Foe)))
        {
            showCard(activeQuest.getQuest());
            Destroy(currentBid);
            Destroy(highestBid);
            if (playerBP == null)
            {
                playerBP = createHeaderMessage(panelPosX - panelWidth / 3, panelHeight / 2, new Vector3(0, 0, 0), " ");
            }
            if (activeQuest != null)
            {
                changeHeaderMessage("Player BP: " + activePlayer.getBP(activeQuest.getQuest().getName()), playerBP);
            }
            else
            {
                changeHeaderMessage("Player BP: " + activePlayer.getBP("null"), playerBP);
            }

            changeHeaderMessage("Select the cards you wish to play in this stage", instructionHeader);
            //createButtonMessage(panelPosX, panelPosY - panelHeight/10, "FIGHT");
            gm.setUserInputState(state.ASKINGFORCARDSINQUEST);
        }
        else if (Object.ReferenceEquals(activeQuest.getCurrentStage().GetType(), typeof(Test)))
        {
            showCard(activeQuest.getCurrentStage());


            if (currentBid == null)
            {
                currentBid = createHeaderMessage(panelPosX - panelWidth / 3, panelHeight / 2, new Vector3(0, 0, 0), " ");
            }
            if (highestBid == null)
            {
                highestBid = createHeaderMessage(panelPosX + panelWidth / 3, panelHeight / 2, new Vector3(0, 0, 0), " ");
            }
            changeHeaderMessage("Current bid: " + activeQuest.getCurrentPlayerFreeBids(), currentBid);
            changeHeaderMessage("Highest bid: " + activeQuest.getHighestBid(), highestBid);
            gm.setUserInputState(state.ASKINGFORCARDSINBID);
        }
        createButtonMessage(panelPosX - panelWidth / 5, panelPosY + panelHeight / 5, "Give up");
    }
Ejemplo n.º 2
0
    public void removeCardSelection(GameObject selected)
    {
        /*
         * This method is called when a card is clicked. Depending on the current gameState, a difference received mthod will be called.
         */

        if (selected == null)
        {
            return;
        }
        int n = multipleCardInput.Length;
        int j = -1;

        GameObject[] temp = new GameObject[n - 1];
        j = selected.GetComponent <CardButtonUI>().getIndexInSelection();

        if (j == 0)
        {
            for (int i = 0; i < n - 1; i++)
            {
                temp[i] = multipleCardInput[i];
            }
        }
        else if (j == multipleCardInput.Length)
        {
            for (int i = 1; i < n; i++)
            {
                temp[i - 1] = multipleCardInput[i];
            }
        }
        else
        {
            for (int i = 0; i < j; i++)
            {
                temp[i] = multipleCardInput[i];
            }
            for (int i = j + 1; i < multipleCardInput.Length; i++)
            {
                temp[i - 1] = multipleCardInput[i];
            }
        }

        multipleCardInput = temp;
        Destroy(selected.GetComponent <CardButtonUI>().getSelectedCardIcon());

        for (int i = 0; i < multipleCardInput.Length; i++)
        {
            multipleCardInput[i].GetComponent <CardButtonUI>().setIndexInSelection(i);
        }
        if (gm.getUserInputState() == state.ASKINGFORCARDSINQUEST)
        {
            changeHeaderMessage("Player BP: " + getPlayersBP(), playerBP);
        }
        if (gm.getUserInputState() == state.ASKINGFORCARDSINBID)
        {
            int currentBidCounter;
            if (multipleCardInput.Length == null)
            {
                currentBidCounter = 0;
            }
            else
            {
                currentBidCounter = multipleCardInput.Length;
            }

            currentBidCounter = currentBidCounter + activeQuest.getCurrentPlayerFreeBids();
            changeHeaderMessage("Current bid: " + currentBidCounter, currentBid);
        }
        return;
    }
Ejemplo n.º 3
0
    public void bidPhase(Card [] selection)
    {
        Debug.Log("bidPhase");
        if (containsMordred(selection) != null)
        {
            askForMordredTarget(selection, containsMordred(selection));
            return;
        }

        log.log("Free bids: " + activeQuest.getCurrentPlayerFreeBids());
        if (selection == null)
        {
            log.log("placing a bid of: 0");
            Debug.Log("placing a bid of: 0");
        }
        else
        {
            log.log("placing a bid of: " + selection.Length);
            Debug.Log("placing a bid of: " + selection.Length);
        }
        activeQuest.placeBid(selection, activeQuest.getCurrentPlayerFreeBids());
        activeQuest.setTentativeBet(selection);
        if (activeQuest.isStageDone())
        {
            log.log("Stage is over.");
            endStage();
        }
        else
        {
            activeQuest.nextPlayer();
            log.log("Moving onto " + activeQuest.getCurrentPlayer().getName());
            startStage();
        }

/*
 *              }
 *              else {
 *                      log.log("Bid is too low.");
 *                      ui.displayAlert("Bid too low. Bid more cards of forfeit the quest.");
 *                      if(	activeQuest.getCurrentPlayer().isHuman())
 *                      {
 *                              ui.askForCards(
 *                                                              activeQuest.getCurrentPlayer(),
 *                                                              activeQuest,
 *                                                              GameState.state.ASKINGFORCARDSINBID,
 *                                                              "Select cards to bid, then press BID",
 *                                                              "BID",
 *                                                              "Give up",
 *                                                              true,
 *                                                              true,
 *                                                              true,
 *                                                              true,
 *                                                              true,
 *                                                              true);
 *
 *
 *                      }
 *                      else {
 *                              forfeitQuest();
 *                      }
 *              }
 */
    }