private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(this); } }
public void ColorUnlockResponse(bool option) { if (option) { PlayerStatsistics.NewColorUnlocked(); Destroy(firstColorList.transform.GetChild(colorSelected).transform.GetChild(0).gameObject); Destroy(secondColorList.transform.GetChild(colorSelected).transform.GetChild(0).gameObject); PlayerPrefsManager.SetPlayerPoints(PlayerPrefsManager.GetPlayerPoints() - colorCost); SQLDataBase.SaveShopItem(10, colorSelected); playerPoints.text = "Points: " + PlayerPrefsManager.GetPlayerPoints(); } colorUnlockPanel.SetActive(false); }
private void SaveLevel() { int levelProgress = (int)(CameraController.Instance.transform.position.x * 100 / Instance.levelLength); if (practiceMode) { if (levelProgress > levelInfo.practiceModeProgress) { levelInfo.practiceModeProgress = levelProgress; } } else if (levelProgress > levelInfo.normalModeProgress) { levelInfo.normalModeProgress = levelProgress; int points = (int)((levelProgress / 100f) * levelInfo.maxPoints) - levelInfo.pointsCollected; PlayerPrefsManager.SetPlayerPoints(points + PlayerPrefsManager.GetPlayerPoints()); levelInfo.pointsCollected += points; } PlayerStatsistics.SaveStats(); LevelManager.SaveLevelToDataBase(levelID); }