Exemple #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();
         }
     }
 }
Exemple #2
0
 public void SetBoost(Boost boost)
 {
     _boost     = boost;
     title.text = boost.GetName();
     cost.text  = boost.GetCost() + "pts";
 }