Esempio n. 1
0
 public void onCoinUse()
 {
     if (PlayerPrefs.GetInt("playerCoins") >= requiredCoin)
     {
         inGameManager.AddCurrency(-requiredCoin, 0);
         inGameManager.ChangeHeartAmount(inGameManager.maxHeart);
     }
     else
     {
         inGameManager.ShowMessageBox("سکه های شما کافی نمی باشد. می توانید از فروشگاه سکه تهیه کنید.");
         shopPopup.SetActive(true);
     }
 }
Esempio n. 2
0
    public void FinishedLevel()
    {
        blockerObj.SetActive(false);

        //checking game result
        if (wonTheLevel)
        {
            gameOverWin.SetActive(true);

            int gainedStars;
            if (levelGoalSlider.value >= 1)
            {
                gainedStars = 3;
            }
            else if (levelGoalSlider.value >= 0.8)
            {
                gainedStars = 2;
            }
            else
            {
                gainedStars = 1;
            }

            for (int i = 0; i < 3; i++)
            {
                gameOverStars[i].sprite = emptyStar;
            }
            for (int i = 0; i < gainedStars; i++)
            {
                gameOverStars[i].sprite = gainedStar;
            }

            overRewardTxt._rawText = levelRewardAmount.ToString();
            overRewardTxt.enabled  = false;
            overRewardTxt.enabled  = true;

            levelCountTxt._rawText = "مرحله " + (currentLevelIndex + 1).ToString();
            levelCountTxt.enabled  = false;
            levelCountTxt.enabled  = true;

            gameData.SetUpNewPlayerLevelData(currentLevelIndex, gainedStars, levelRewardAmount);

            //Game Analytics progression data update
            GameAnalyticsManager.Instance.SendProgressionEvent(2, "world0", "level" + (currentLevelIndex + 1));

            //adding level reward coins
            inGameManager.AddCurrency(levelRewardAmount, 0);
            GameAnalyticsManager.Instance.SendResourceEvent(1, "Coin", levelRewardAmount, "LevelReward", "LevelCoinReward");
        }
        else
        {
            inGameManager.ChangeHeartAmount(-1);

            if (!hasUsedContinue)
            {
                GameAnalyticsManager.Instance.SendDesignEvents("InGame:Continue:didn'tContinue");

                gameOverLose.SetActive(true);
                hasUsedContinue = true;
            }
            else
            {
                GameAnalyticsManager.Instance.SendDesignEvents("InGame:Continue:Continued");

                finalGameOverObj.SetActive(true);
            }
            //Game Analytics progression data update
            GameAnalyticsManager.Instance.SendProgressionEvent(3, "world 0", "level " + (currentLevelIndex + 1));
        }
    }