/// Gives the value according to the component X position private void checkPosition(Boolean setVal = false) { float xFinal = lineRectangle.X + (lineRectangle.Width - 10); float normalizer = 1 + ((lineRectangle.Width - 20) - 100) / valueScale; float val = setVal ? xValue : Maths.Clamp(Control.MouseCoordinates.X, lineRectangle.X + 10, xFinal); xValue = (int)val; Value = ((val - (lineRectangle.X + 10)) / valueScale) / normalizer; setPosition((int)val - 10, lineRectangle.Y); }
public static void updateScore(int addScore) { if (Player.Instance.isDead) { return; } score += addScore * scoreMultiplier; if (score > highscore && !beatedHighscore) { beatedHighscore = true; Sound.playerHighscore.Play(.8f, Maths.random.RandomRange(-.2f, .2f), 0); } if (score >= newLifeScore) { newLifeScore += (givenLives += 2) * initialLifeScore; if (life <= maxLife) { life++; if (!isMaxLife) { if (life >= maxLife) { isMaxLife = true; } Sound.playerLife.Play(1f, Maths.random.RandomRange(-.2f, .2f), 0); } life = (int)Maths.Clamp(life, 0, maxLife); } } Info.totalExperience += addScore; SkillManager.updateLeveling(false, false); }