Score multiplier system

Today I was able to implement a score multiplier system. We thought this would be essential for some variation for high scores if we want to include leaderboards.

scoremultiply

Early implementation of HUD multiplier feedback

My next step for this is to set it up so that when the multiplier is not active (when it has a value of 1) it will be hidden.

Code (added to exisiting score manager code):

void Update()
    {
        if (PlayerDie.PlayerAlive == true && pauseGame.paused == false)
        {
            score = score + (scorescale * scoreMultiplier * Time.time); //score growth rate increases over time

            //will add code to make score scale reset to 0 every time damage is taken.

            TextScore = scoreScreen.GetComponent();
            TextScore.text = Mathf.Floor(score).ToString();

            Multiplier = scoreMultiplier;
            //for public inspector feedback on multiplier

            MultiplyScore.text = Mathf.Abs(scoreMultiplier).ToString("0.#");

            ScoreMultiply();
            //run score multiply control system
        }
    }

void ScoreMultiply()
    {
        if (scoreMultiplier > 1f && ResetOK == false)
        {
            ResetOK = true;
            StartCoroutine (MultiplyReset());
        }
    }

    IEnumerator MultiplyReset() //resets the multiplier to 0 after shooting no enemies for a certain amount of time

    {
        yield return new WaitForSeconds(MultiplierResetTime);
        scoreMultiplier = 1f;
        ResetOK = false;
    }

2 comments

  1. Dr Slater's avatar
    Dr Slater · January 11, 2016

    Good Day,

    I’m looking for a function similar to the leaderboard. Would you be able to advise on the coding?

    Regards,

    Kirsten Slater.

    Like

    • Boma's avatar
      Boma · January 13, 2016

      Hello,
      I haven’t implemented a scoreboard system yet but I will do in the upcoming weeks, I’ll make a blog post about it with the code when I get to that part of my schedule.
      Sorry I couldn’t be of much help.
      Regards
      Boma West

      Liked by 1 person

Leave a comment