public void SetLevel(int levelIndex) { if (gameData.levelDatas[levelIndex].lvlState < 0) { Debug.Log("This level is not available!!"); inGameManager.ShowMessageBox("هنوز این مرحله رو باز نکردید و نمی تونید بازیش کنید."); return; } else if (gameData.levelDatas[levelIndex].lvlState > 0) { if (gameData.levelDatas[levelIndex].starsAmount == 3) { Debug.Log("You have finished the level."); inGameManager.ShowMessageBox("این مرحله رو سه ستاره و تموم کرده اید."); return; } } if (PlayerPrefs.GetInt("ActiveHearts") < 1) { notEnoughHeartPopup.SetActive(true); Debug.Log("Not enough hearts!!"); return; } levelSelectionAudioSource.Play(); hasUsedContinue = false; finishedTheCurrentLevel = false; rewardGameObj.SetActive(false); inGame.SetActive(true); GameMenu.SetActive(false); continuePriceTxt._rawText = continuePrice.ToString(); continuePriceTxt.enabled = false; continuePriceTxt.enabled = true; currentLevelIndex = levelIndex; moveAmountText._rawText = levels[currentLevelIndex].moves.ToString(); moveAmountText.enabled = false; moveAmountText.enabled = true; gameOverWin.SetActive(false); gameOverLose.SetActive(false); coinAmountText._rawText = "0"; coinAmountText.enabled = false; coinAmountText.enabled = true; levelCoinGoals[0] = levels[currentLevelIndex].GetLevelGoals(0); //Debug.Log("goal 1: " + levelCoinGoals[0]); levelCoinGoals[1] = levels[currentLevelIndex].GetLevelGoals(1); //Debug.Log("goal 2: " + levelCoinGoals[1]); levelCoinGoals[2] = levels[currentLevelIndex].GetLevelGoals(2); //Debug.Log("goal 3: " + levelCoinGoals[2]); foreach (Image star in goalStars) { star.sprite = EmptyStar; } levelGoalSlider.value = 0; levelRewardAmount = 0; usedMoves = 0; wonTheLevel = false; gameBoardManager.NewBoard(); orderHandler.StartTheDay(); }