public IEnumerator VerifyBankerUpdatesTotalMoneyAmountCorrectly() { GameObject obj = new GameObject(); obj.AddComponent <Banker>(); Banker banker = obj.GetComponent <Banker>(); yield return(null); float expectedTotalMoneyAmount = banker.TotalMoneyAmount - 100000; banker.ReduceTotalMoneyAmount(100000); Assert.AreEqual(expectedTotalMoneyAmount, banker.TotalMoneyAmount); }
public override void OnPointerClick(PointerEventData data) { Debug.Log($"OnPointerClick called: {gameObject.name}"); if (gameState.isPickingFirstSuitcase) { // Select Initial Suitcase Event // initialize chosen suitcase with valid number and money amount chosenSuitcase.SuitcaseData = suitcaseDisplay.suitcase; suitcaseDisplay.gameObject.SetActive(false); gameState.isPickingFirstSuitcase = false; instructionPanel.GetComponent <InstructionalTextDisplay>().UpdateText(); } else { // Open Suitcase Event if (!gameState.isBankerPresentingAnOffer && !gameState.isGameOver && suitcaseDisplay.transform.Find("Closed").gameObject.activeInHierarchy) { banker.DecrementSuitcaseCount(); banker.ReduceTotalMoneyAmount(suitcaseDisplay.suitcase.moneyAmount); // reveal money amount suitcase contained suitcaseDisplay.transform.Find("Closed").gameObject.SetActive(false); ++gameState.currentSuitcasesOpenedCount; ++gameState.totalSuitcasesOpened; MoneyDisplay scoreDisplay = scoreboardPanel.GetComponent <Scoreboard>().Displays .FirstOrDefault(display => display.moneyAmount == suitcaseDisplay.suitcase.moneyAmount); scoreDisplay.FadeoutDisplay(); } if (!gameState.isBankerPresentingAnOffer && !gameState.isGameOver && GameConstants.casesToOpenPerRound[gameState.currentRoundNumber] <= gameState.currentSuitcasesOpenedCount) { // Present Banker Offer Event gameState.currentBankerOffer = banker.CalculateOffer(GameConstants.bankerOfferPercentagesPerRound[gameState.currentRoundNumber]); gameState.isBankerPresentingAnOffer = true; bankerOfferPanel.SetActive(true); bankerOfferPanel.GetComponent <BankerOffer>().SetOfferValueText(); instructionPanel.SetActive(false); } } }