Ejemplo n.º 1
0
 public void EndGameBetResult(int lastNumber)
 {
     if (acceptedTheBet)
     {
         betResultPopup.SetActive(true);
         if (lastNumber >= betNumberToHit)
         {
             gameManager.AddCoinToPlayer((int)BetRewardAmount);
             endRewardText.text = BetRewardAmount.ToString();
             endGameWon.SetActive(true);
             endGameLose.SetActive(false);
         }
         else
         {
             gameManager.AddCoinToPlayer((int)BetPenaltyAmount);
             endPenaltyText.text = BetPenaltyAmount.ToString();
             endGameLose.SetActive(true);
             endGameWon.SetActive(false);
         }
     }
     else
     {
         endGameMenu.SetActive(true);
         betResultPopup.SetActive(false);
     }
 }
Ejemplo n.º 2
0
    public void CheckForABetAndStart()
    {
        if (PlayerPrefs.GetInt("BestPassed") > startBettingAfterThisScore &&
            PlayerPrefs.GetInt("RunCount") % betOfferInterval == 0)
        {
            //selecting the bet number
            int randomNumber = Random.Range(numberToHitLess, numberToHitMore);
            //finds the bet number which is multipleable to the betNumberMultiple
            betNumberToHit  = ((Mathf.Round((PlayerPrefs.GetInt("BestPassed") + numbersManager.startingNumber + randomNumber) / betNumberMultiple)) * betNumberMultiple);
            numberText.text = betNumberToHit.ToString();

            //selecting the bet reward -----------------------change this!
            BetRewardAmount     = Random.Range(10, 100);
            rewardCoinText.text = BetRewardAmount.ToString();

            //selecting the bet penalty -----------------------change this!
            BetPenaltyAmount  = -Random.Range(10, 80);
            loseCoinText.text = BetPenaltyAmount.ToString();

            bettingPopup.SetActive(true);
        }
        else
        {
            gameManager.StartARun();
        }
    }