Beispiel #1
0
 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();
         }
     }
 }
Beispiel #2
0
        public void UpdatePoints()
        {
            int points = LevelSettings.GetUserProfile().GetPoints();

            pointsCount.text = "You have " +
                               (points == 0 ? "no" : points.ToString()) +
                               " parts to spend";
        }
Beispiel #3
0
 private void StartGame()
 {
     PlayerPrefs.SetInt("UserScore", LevelSettings.GetUserProfile().GetPoints());
     Destroy(gameObject);
     FindObjectOfType <ShipBehaviour>().StartGame();
 }