Beispiel #1
0
    private void BuyRestaurant(int purchaser, double payment)
    {
        gameController.player[purchaser].AddMoney(-payment);
        // get reference to the tile we are bidding on so that i can reference the restaurant we created
        //WorldTile newRest = vacantTile.tile;
        if (gameController.player[purchaser].playerFaction.style == FactionStyle.MEXICAN)
        {
            WorldTile newRest = vacantTile.Buy(mexRestaurantFab, purchaser);
            //change the color of the playericon to reflect the purchaser's color
            newRest.gameObject.GetComponentInChildren <PlayerIconScript>().updateColor(purchaser);
        }
        else if (gameController.player[purchaser].playerFaction.style == FactionStyle.ITALIAN)
        {
            WorldTile newRest = vacantTile.Buy(italianRestaurantFab, purchaser);
            newRest.gameObject.GetComponentInChildren <PlayerIconScript>().updateColor(purchaser);
        }
        else if (gameController.player[purchaser].playerFaction.style == FactionStyle.AMERICAN)
        {
            WorldTile newRest = vacantTile.Buy(americanRestaurantFab, purchaser);
            newRest.gameObject.GetComponentInChildren <PlayerIconScript>().updateColor(purchaser);
        }

        Debug.Log("Payed: $" + payment.ToString());
    }
Beispiel #2
0
 //function should be pointless now
 public void Buy()
 {
     if (gameController.activePlayer.GetMoney() >= cost)
     {
         cameraScript.TurnCanMoveTrue();
         try
         {
             //Moved Building.Buy to below this (it was here) Because it destroys this script and ends the function
             gameController.activePlayer.AddMoney(-cost);
             // Play succesful purchase sound
             cameraScript.TurnCanMoveTrue(); //might be unnecessary
             building.Buy(MexRestaurantFab);
         }
         catch { }
     }
     else
     {
         // play unsuccesful purchase sound
     }
 }