Exemple #1
0
    /**
     * this function checks if the score earned on this level this time is the highest score EVER
     */
    void saveHighScore()
    {
        prevHighScore = PlayerPrefs.GetInt("Stomach" + (level.getLevel() - 1));                 // get the old saved high score

        // check if high score
        if (prevHighScore < numStars)
        {
            // if it is the high score save it
            prevHighScore = numStars;
            PlayerPrefs.SetInt("Stomach" + (level.getLevel() - 1), numStars); // save the score
            PlayerPrefs.Save();                                               // needs to be called to write the data to disk
        }
    }
Exemple #2
0
    /**
     * Draws the background image for the mouth loading screen
     */
    void OnGUI()
    {
        counter = GameObject.Find("StomachChooseBackground");                           // find the reference to the mouth background choser
        level   = counter.GetComponent <StomachLoadLevelCounter> ();                    // get the current level from the counter

        // draw the proper level load screen to take up the entiere screen
        GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height),
                        backgrounds [Mathf.Clamp(level.getLevel() - 1, 0, level.getMaxLevels())]);
    }