public void ChangeStatPts(bool increase, string stat) { int points = 0; GameObject gameObject = statObjJump;//defaulting to make the compiler happy if (stat == "JumpHeight") { points = mytools.settings.PlayerStatsJumpHeightPts; gameObject = statObjJump; } else if (stat == "HitForce") { points = mytools.settings.PlayerStatsHitForcePts; gameObject = statObjHit; } else if (stat == "MoveSpeed") { points = mytools.settings.PlayerStatsMoveSpeedPts; gameObject = statObjMove; } else if (stat == "CoinGrav") { points = mytools.settings.PlayerStatsCoinGravityPts; gameObject = statObjGrav; } else if (stat == "TimeCont") { points = mytools.settings.PlayerStatsTimeControlPts; gameObject = GameObject.Find("PlayerStatsTimeControlPtsValue");; } else { Debug.Log("wrong input to stats"); } if (increase && points < 5) { points++; Debug.Log(stat + " Increased to " + points); mytools.Save(); } else if (!increase && points > 0) { points--; Debug.Log(stat + " Decreased to " + points); mytools.Save(); } else { Debug.Log("unable to change " + stat + " - " + points); } gameObject.GetComponent <UnityEngine.UI.Text>().text = points.ToString(); }
public int Scorelogic(int newhighscore) { int oldHighscore = mytools.settings.HighScore; if (newhighscore > oldHighscore) { mytools.settings.HighScore = newhighscore; mytools.Save(); TextUpdate("highscoreText", newhighscore); //Debug.Log("we did it! " + newhighscore); return(newhighscore); } else { TextUpdate("highscoreText", oldHighscore); //Debug.Log("we NOT did it! " + oldHighscore); return(oldHighscore); } }