Beispiel #1
0
        public void PurchaseItems(string userInput, int totalPurchased)
        {
            int startingCash = players[playerCounter % 2].myGrubs;

            switch (userInput)
            {
            case "bananas":
                players[playerCounter % 2].myGrubs = GameStore.Cashier(1, players[playerCounter % 2].myGrubs, players[playerCounter % 2].MyInventory.totalInventory, totalPurchased);
                break;

            case "bugs":
                players[playerCounter % 2].myGrubs = GameStore.Cashier(2, players[playerCounter % 2].myGrubs, players[playerCounter % 2].MyInventory.totalInventory, totalPurchased);
                break;

            case "ice":
                players[playerCounter % 2].myGrubs = GameStore.Cashier(3, players[playerCounter % 2].myGrubs, players[playerCounter % 2].MyInventory.totalInventory, totalPurchased);
                break;

            case "cups":
                players[playerCounter % 2].myGrubs = GameStore.Cashier(4, players[playerCounter % 2].myGrubs, players[playerCounter % 2].MyInventory.totalInventory, totalPurchased);
                break;

            case "all":
                players[playerCounter % 2].myGrubs = GameStore.Cashier(5, players[playerCounter % 2].myGrubs, players[playerCounter % 2].MyInventory.totalInventory, totalPurchased);
                break;

            default:
                UserInterface.DefaultResponse();
                GamePlay();
                break;
            }

            if (players[playerCounter % 2].myGrubs == startingCash)
            {
                UserInterface.SpentTooMuch();
                GamePlay();
            }
            else
            {
                GamePlay();
            }
        }