private void CheckPriceAndTake(bool isOn) { if (isOn) { if (!LevelSettings.selectedBoosts.Contains(_boost) && LevelSettings.GetUserProfile().GetPoints() - _boost.GetCost() >= 0) { LevelSettings.GetUserProfile().ChangePointsBy(-_boost.GetCost()); LevelSettings.selectedBoosts.Add(_boost); FindObjectOfType <ChooseBoostDialog>().UpdatePoints(); } else { toggle.isOn = false; } } else { if (LevelSettings.selectedBoosts.Contains(_boost)) { LevelSettings.GetUserProfile().ChangePointsBy(_boost.GetCost()); LevelSettings.selectedBoosts.Remove(_boost); FindObjectOfType <ChooseBoostDialog>().UpdatePoints(); } } }
public void UpdatePoints() { int points = LevelSettings.GetUserProfile().GetPoints(); pointsCount.text = "You have " + (points == 0 ? "no" : points.ToString()) + " parts to spend"; }
private void StartGame() { PlayerPrefs.SetInt("UserScore", LevelSettings.GetUserProfile().GetPoints()); Destroy(gameObject); FindObjectOfType <ShipBehaviour>().StartGame(); }