Exemplo n.º 1
0
    public string richestPlayer(ArrayList listOfPlayers)
    {
        var highMoney  = 0;
        var highPlayer = new PlayMoving();
        var tempPlayer = new PlayMoving();

        for (int i = 0; i < listOfPlayers.Count; i++)
        {
            tempPlayer = (PlayMoving)listOfPlayers[i];
            print("looking at: " + tempPlayer.getName());
            if (highMoney < monopolyGame.getWallet(tempPlayer).getWalletAmount())
            {
                highPlayer = tempPlayer;
                highMoney  = monopolyGame.getWallet(tempPlayer).getWalletAmount();
            }
        }
        monopolyGame.consoleText = "high score found!";
        CurrentWinner_Label.text = highPlayer.getName();
        return(highPlayer.getName());
    }
Exemplo n.º 2
0
    private void updatePlayOrder()
    {
        var thisPlayer = new PlayMoving();
        var tempText   = "";

        for (int i = 0; i < PlayerList.Count; i++)
        {
            thisPlayer = (PlayMoving)PlayerList[i];
            tempText  += thisPlayer.getName() + " ";
        }
        PlayOrder.text = tempText;
    }
Exemplo n.º 3
0
 IEnumerator ani_CC()
 {
     if (CCnumber == 1)
     {
         cc_Animator.SetTrigger("refreshed");
         cc_Animator.SetInteger("pointer", 1);
         CCnumber = 0;
         monopolyGame.getWallet(currentPlayer).addMoney(100);
         monopolyGame.consoleText = currentPlayer.getName() + " you inheirted $100";
     }
     if (CCnumber == 2)
     {
         cc_Animator.SetTrigger("refreshed");
         cc_Animator.SetInteger("pointer", 2);
         CCnumber = 0;
         monopolyGame.getWallet(currentPlayer).addMoney(200);
         monopolyGame.consoleText = currentPlayer.getName() + " bank error in favor, collect $200";
     }
     if (CCnumber == 3)
     {
         cc_Animator.SetTrigger("refreshed");
         cc_Animator.SetInteger("pointer", 3);
         CCnumber = 0;
         monopolyGame.getWallet(currentPlayer).subtractMoney(100);
         monopolyGame.consoleText = currentPlayer.getName() + " paid hospital $100";
     }
     if (CCnumber == 4)
     {
         cc_Animator.SetTrigger("refreshed");
         cc_Animator.SetInteger("pointer", 4);
         CCnumber = 0;
         currentPlayer.forceNewLocation(40);
         monopolyGame.consoleText = currentPlayer.getName() + " is going to jail";
     }
     if (CCnumber == 5)
     {
         cc_Animator.SetTrigger("refreshed");
         cc_Animator.SetInteger("pointer", 5);
         CCnumber = 0;
         monopolyGame.getWallet(currentPlayer).addMoney(10);
         monopolyGame.consoleText = currentPlayer.getName() + " won beauty contest, collect $10";
     }
     if (CCnumber == 6)
     {
         cc_Animator.SetTrigger("refreshed");
         cc_Animator.SetInteger("pointer", 6);
         CCnumber = 0;
         var player_W  = (PlayerWallet)monopolyGame.getWallet(currentPlayer);
         var incomeTax = (int)(player_W.getWalletAmount() * 0.15);
         monopolyGame.getWallet(currentPlayer).addMoney(incomeTax);
         monopolyGame.consoleText = currentPlayer.getName() + " income tax refund";
     }
     if (Input.GetKeyDown(KeyCode.Delete))
     {
         cc_Animator.SetTrigger("next");
     }
     yield return(new WaitForEndOfFrame());
 }
Exemplo n.º 4
0
 private bool isGoingToJail()
 {
     //check if the player's current position is at jail
     print(currPlayer.getName() + " checking...");
     if (currPlayer.currentSpaceNum == 30)
     {
         print("player has landed on GoToJail");
         //>>><<change currPlayer JailStatus here.
         return(true);            //if so, edit jail status and jail counts return true
     }
     else
     {
         print("nope, player is safe!");
         return(false);
     }
 }
Exemplo n.º 5
0
 IEnumerator ani()
 {
     if (ChanceNumber == 1)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 1);
         ChanceNumber = 0;
         monopolyGame.getWallet(actingPlayer).subtractMoney(15);
         monopolyGame.updateCV_money(15);
         monopolyGame.consoleText = actingPlayer.getName() + "paid $15 poor tax";
     }
     if (ChanceNumber == 2)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 2);
         ChanceNumber = 0;
         actingPlayer.forceNewLocation(0);
         monopolyGame.getWallet(actingPlayer).addMoney(200);
         monopolyGame.consoleText = actingPlayer.getName() + " adv. to GO with $200";
     }
     if (ChanceNumber == 3)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 3);
         ChanceNumber = 0;
         var nLoc = actingPlayer.currentSpaceNum - 3;
         if (nLoc < 0)
         {
             nLoc = 40 + nLoc;
         }
         actingPlayer.forceNewLocation(nLoc);
         monopolyGame.consoleText = actingPlayer.getName() + " went back 3 spaces";
     }
     if (ChanceNumber == 4)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 4);
         ChanceNumber = 0;
         var otherPlayer = new PlayMoving();
         for (int i = 1; i < monopolyGame.GetPlayerList().Count; i++)
         {
             otherPlayer = (PlayMoving)monopolyGame.GetPlayerList()[i];
             monopolyGame.getWallet(otherPlayer).addMoney(50);
             monopolyGame.getWallet(actingPlayer).subtractMoney(50);
         }
         monopolyGame.consoleText = actingPlayer.getName() + " became chairman, paid $50 to ea. player";
     }
     if (ChanceNumber == 5)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 5);
         ChanceNumber = 0;
         actingPlayer.forceNewLocation(40);
         monopolyGame.consoleText = actingPlayer.getName() + " is going to jail!";
     }
     if (ChanceNumber == 6)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 6);
         ChanceNumber = 0;
         monopolyGame.getWallet(actingPlayer).addMoney(150);
         monopolyGame.consoleText = actingPlayer.getName() + " building and loan matures, collect $150";
     }
     if (Input.GetKeyDown(KeyCode.Delete))
     {
         chance_Animator.SetTrigger("next");
         monopolyGame.consoleText = "debug, Chance_next pressed";
     }
     yield return(new WaitForEndOfFrame());
 }
Exemplo n.º 6
0
    public void specialLandProcess(PlayMoving thePlayer, PlayerWallet theWallet, ArrayList spLand)
    {
        var tempCounter = 0;

        //railroads
        if (((int)spLand [1] == 5) || ((int)spLand [1] == 15) || ((int)spLand [1] == 25) || ((int)spLand [1] == 35))
        {
            var tempOwner = getOwner(spLand);              //checks if the railroad is owned
            if (tempOwner != null)
            {
                for (int i = 0; i < theWallet.myLandList.Count - 1; i++)
                {
                    var tempArr = (ArrayList)theWallet.myLandList [i];
                    if (tempArr [3].ToString() == "r")
                    {
                        tempCounter++;
                    }
                }
                getOwner(spLand).addMoney(tempCounter * 75);                  //probalby need to fix these lines for datastructures
                theWallet.subtractMoney(tempCounter * 75);
                print("railroad rent paid");
            }
            else if (theWallet.getWalletAmount() > 200)
            {
                monopolyGame.LocationLibrary.getLand(thePlayer.currentSpaceNum).Add(theWallet);
                theWallet.subtractMoney(200);
                print(thePlayer.getName() + "bought railroad");
            }
            else
            {
                print("player doesnt have enough money to buy railroad");
            }
        }

        //utility
        else if (((int)spLand [1] == 12) || ((int)spLand [1] == 28))
        {
            var tempOwner = getOwner(spLand);              //checks if the railroad is owned
            if (tempOwner != null)
            {
                for (int i = 0; i < theWallet.myLandList.Count - 1; i++)
                {
                    var tempArr = (ArrayList)theWallet.myLandList [i];
                    if (tempArr [3].ToString() == "u")
                    {
                        tempCounter++;
                    }
                }
                var number = Random.Range(2, 12);
                getOwner(spLand).addMoney(tempCounter * 4 * number);                  //probalby need to fix these lines for datastructures
                theWallet.subtractMoney(tempCounter * 4 * number);
                print("utilities paid");
            }
            else if (theWallet.getWalletAmount() > 150)
            {
                monopolyGame.LocationLibrary.getLand(thePlayer.currentSpaceNum).Add(theWallet);
                theWallet.subtractMoney(150);
                print(thePlayer.getName() + "bought utility");
            }
            else
            {
                print("player doesnt have enough money to buy utility");
            }
        }

        //income tax --addmoney to communityvault
        else if ((int)spLand [1] == 4)
        {
            var tempMoney = (int)(theWallet.getWalletAmount() * 0.15);
            theWallet.subtractMoney(tempMoney);
            monopolyGame.updateCV_money(tempMoney);
            print("taxes paid");
            monopolyGame.consoleText = thePlayer.getName() + " has paid taxes!";
        }

        //luxury tax
        else if ((int)spLand [1] == 38)
        {
            theWallet.subtractMoney(75);
            print("luxury tax paid");
        }

        //community chest
        else if (((int)spLand [1] == 2) || ((int)spLand [1] == 17) || ((int)spLand [1] == 33))
        {
            CCdeck.CCnumber = Random.Range(1, 7);
        }

        //chance
        else if (((int)spLand [1] == 7) || ((int)spLand [1] == 22) || ((int)spLand [1] == 36))
        {
            chanceDeck.ChanceNumber = Random.Range(1, 7);
        }
        else if ((int)spLand [1] == 20)            //landed on free parking
        {
            theWallet.addMoney(monopolyGame.getCV_money());
            monopolyGame.updateCV_money(-monopolyGame.getCV_money());
            print("player cleared the community vault");
            monopolyGame.consoleText = "Community Vault has been emptied by: " + thePlayer.getName();
        }
        else if (((int)spLand [1] == 0))
        {
            monopolyGame.consoleText = thePlayer.getName() + " is on GO! ";
            thePlayer.passedGO       = true;
        }
        else
        {
            print("merp, nothing special");
            //monopolyGame.consoleText = "Not a special place";
        }
    }
Exemplo n.º 7
0
    //methods below are used to excute the Movement of a single Player.

    public void playerMove(PlayMoving myPlayer)
    {
        //make player roll dice
        var newDistance = stepsToTake();

        //generate random number, but also correspond to dice animation


        myPlayer.travelToNewLocation(newDistance);         //have player move to newlocation
        //^(imbeded within PlayMoving.cs)^check to see to see if player passed GO

        if (isGoingToJail())           //check to see if player is going to jail (various ways)
        {
            print("player is going to jail");
            myPlayer.forceNewLocation(40);
        }
        //monopolyGame.consoleText = "did not pass go";
        if (myPlayer.hasPassedGo())
        {
            //monopolyGame.consoleText = "has just passed GO! adding money...";
            monopolyGame.getWallet(myPlayer).getWalletAmount();
            monopolyGame.getWallet(myPlayer).addMoney(200);
            myPlayer.resetPassGo();
            print("money added. wallet: " + monopolyGame.getWallet(myPlayer).getWalletAmount());
        }

        var currentLand = (ArrayList)monopolyGame.LocationLibrary.getLand(myPlayer.currentSpaceNum);

        monopolyGame.consoleText = myPlayer.getName() + " traveling to : " + ((ArrayList)monopolyGame.LocationLibrary.getLand(myPlayer.targetSpaceNum))[0];
        if (monopolyGame.LocationLibrary.isSpecialLand(currentLand))
        {
            //	monopolyGame.consoleText =  "special land...";
            monopolyGame.LocationLibrary.specialLandProcess(myPlayer, monopolyGame.getWallet(myPlayer), monopolyGame.LocationLibrary.getLand(myPlayer.currentSpaceNum));
        }
        else if (hasBeenBought(currentLand))         //check to see if spot has been bought
        {
            var rentAmount = (int)monopolyGame.LocationLibrary.calculateRent(currentLand);
            //var landOwner = (PlayerWallet)monopolyGame.LocationLibrary.getOwner(currentLand);
            //var myPwallet = monopolyGame.getWallet(myPlayer);
            if (!(Object.Equals(monopolyGame.getWallet(myPlayer), monopolyGame.LocationLibrary.getOwner(currentLand))))
            {
                //rent paying still needs to be validated

                print("this amount being paid: " + rentAmount);
                monopolyGame.getWallet(myPlayer).subtractMoney(rentAmount);
                //myPwallet.subtractMoney(rentAmount);		//if bough, pay rent
                monopolyGame.LocationLibrary.getOwner(currentLand).addMoney(rentAmount);
                monopolyGame.consoleText = "rent paid";
            }
            else if (ReferenceEquals((PlayerWallet)monopolyGame.LocationLibrary.getOwner(currentLand), monopolyGame.getWallet(myPlayer)))            //checks to see if Owned land and builds house
            {
                print("attempting building house");
                //<<insert buildHouse function
                if (monopolyGame.LocationLibrary.buildHouse((ArrayList)monopolyGame.LocationLibrary.getLand(myPlayer.currentSpaceNum)))
                {
                    monopolyGame.getWallet(myPlayer).subtractMoney((int)currentLand[2]);
                }
            }
        }
        else
        {
            buyLand_AI(myPlayer);             //checks to see if theres enough money, buys if possible
        }
    }