コード例 #1
0
    public void auctionControlFlow()
    {
        AuctionHandler auction = State.getAuctionHandler();

        Debug.Log("Begin Auction Control Flow");
        App    app         = UnityEngine.Object.FindObjectOfType <App>();
        int    playerIndex = app.GetHumanIndex();
        Nation humanPlayer = State.getNations()[playerIndex];

        // int start = currentBidPosition;
        //for (int i = start; i < biddingOrder.Count; i++)
        //{
        while (true)
        {
            Debug.Log("Top of while loop");
            Nation currentPlayer = State.getNations()[auction.getBiddingOrder()[auction.CurrentBidPosition]];
            State.setCurrentPlayer(auction.getBiddingOrder()[auction.CurrentBidPosition]);

            Debug.Log("Current Position is: " + auction.CurrentBidPosition);
            Debug.Log("Current Bidder is: " + currentPlayer.getName());
            Debug.Log("Curret Bidder Index is: " + currentPlayer.getIndex());
            //Debug.Log("Current player - " + currentPlayer.nationName);
            Debug.Log("Current player passed already? :" + auction.getIfPlayerPass(currentPlayer.getIndex()));
            if (humanPlayer.getIndex() == currentPlayer.getIndex() && !auction.getIfPlayerPass(humanPlayer.getIndex()))
            //  if (humanPlayer.getIndex() == currentPlayer.getIndex())
            {
                Debug.Log("Current is human");
                return;
            }
            if (humanPlayer.getIndex() == currentPlayer.getIndex() && auction.getIfPlayerPass(humanPlayer.getIndex()))
            {
                auction.incrementBiddingPosition();
                return;
            }

            else if (currentPlayer.getIndex() == auction.getHighestBidderSoFar())
            {
                Debug.Log("Returned to highest bidder (auction presumably over) " + auction.CurrentBidPosition);
                return;
            }
            else
            {
                Debug.Log("AI bid");
                auction.newBid(currentPlayer);
            }
            auction.incrementBiddingPosition();
        }
    }
コード例 #2
0
    private void playerPass()
    {
        Debug.Log("Player Passes  >>>>>>>>>>>>>>>>>>>>>>>>>>");
        AuctionHandler auction     = State.getAuctionHandler();
        App            app         = UnityEngine.Object.FindObjectOfType <App>();
        int            playerIndex = app.GetHumanIndex();
        Text           bidText     = bid.GetComponentInChildren <Text>();

        auction.tempHumanBidLevel = auction.getPlayerBid(playerIndex);
        auction.passOnBid(playerIndex);
        auction.incrementBiddingPosition();
        nextAuctionPhase();
        // Nation player = State.getNations()[playerIndex];
    }
コード例 #3
0
    private void playerBid()
    {
        Debug.Log("Player bids >>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        AuctionHandler auction     = State.getAuctionHandler();
        App            app         = UnityEngine.Object.FindObjectOfType <App>();
        int            playerIndex = app.GetHumanIndex();
        int            playerBid   = auction.getTempHumanBidLevel();

        auction.setPlayerBid(playerIndex, playerBid);
        auction.setIndexOfHighestBidderSoFar(playerIndex);
        //State.CurrentColonyAuctionBid = auction.getPlayerBid(playerIndex);
        State.UpdateColonyAuctionBid(auction.getPlayerBid(playerIndex));
        auction.incrementBiddingPosition();

        nextAuctionPhase();
    }