Exemple #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();
        }
    }