Example #1
0
    public void showstars()
    {
        // freeze menu buttons
        foreach (GameObject button in menuObjects)
        {
            button.GetComponent <Button>().interactable = false;
        }

        // change cursor back:
        cursor.setMouse();
        dc.BackToDeselect();


        // Ryan: victory sound here!
        AudioSource levelComplete = gameObject.GetComponent <AudioSource> ();

        levelComplete.Play();

        //sound.SetActive (false);
        footsound.mute = true;
        int usage = PlayerPrefs.GetInt("usage");

        txt.text       = "Number of tools used: " + usage.ToString();
        Time.timeScale = 0;
        if (usage <= par1)
        {
            score1 = 3;
            foreach (GameObject g in starObjects)
            {
                g.SetActive(true);
            }
        }
        else if (usage <= 2 * par1)
        {
            score1 = 2;
            foreach (GameObject g in starObjects)
            {
                if (g.name != "star3")
                {
                    g.SetActive(true);
                }
            }
        }
        else
        {
            score1 = 1;
            foreach (GameObject g in starObjects)
            {
                if (g.name != "star3" && g.name != "star2")
                {
                    g.SetActive(true);
                }
            }
        }
        PlayerPrefs.SetInt("score1", score1);
        lb.savescore(score1);
    }
Example #2
0
    public void showstars()
    {
        // change cursor back:
        cursor.setMouse();
        dc.BackToDeselect();

        AudioSource levelComplete = gameObject.GetComponent <AudioSource> ();

        levelComplete.Play();

        //sound.SetActive (false);
        footsound.mute = true;
        int usage = PlayerPrefs.GetInt("usage");

        txt.text       = "Number of tools used: " + usage.ToString();
        Time.timeScale = 0;
        if (usage <= par9)
        {
            score9 = 3;
            foreach (GameObject g in starObjects)
            {
                g.SetActive(true);
            }
        }
        else if (usage <= 2 * par9)
        {
            score9 = 2;
            foreach (GameObject g in starObjects)
            {
                if (g.name != "star3")
                {
                    g.SetActive(true);
                }
            }
        }
        else
        {
            score9 = 1;
            foreach (GameObject g in starObjects)
            {
                if (g.name != "star3" && g.name != "star2")
                {
                    g.SetActive(true);
                }
            }
        }
        score9 = score9 + PlayerPrefs.GetInt("score8");
        PlayerPrefs.SetInt("score9", score9);
        lb.savescore(score9);
    }
Example #3
0
    public void showstars()
    {
        // change cursor back:
        cursor.setMouse();
        dc.BackToDeselect();

        //sound.SetActive (false);
        footsound.mute = true;
        int usage = PlayerPrefs.GetInt("usage");

        txt.text       = "Number of tools used: " + usage.ToString();
        Time.timeScale = 0;
        if (usage <= par10)
        {
            score10 = 3;
            foreach (GameObject g in starObjects)
            {
                g.SetActive(true);
            }
        }
        else if (usage <= 2 * par10)
        {
            score10 = 2;
            foreach (GameObject g in starObjects)
            {
                if (g.name != "star3")
                {
                    g.SetActive(true);
                }
            }
        }
        else
        {
            score10 = 1;
            foreach (GameObject g in starObjects)
            {
                if (g.name != "star3" && g.name != "star2")
                {
                    g.SetActive(true);
                }
            }
        }
        score10 = score10 + l9.score9;
        lb.savescore(score10);
    }
Example #4
0
    public void showstars()
    {
        // freeze menu buttons
        foreach (GameObject button in menuObjects)
        {
            button.GetComponent <Button>().interactable = false;
        }

        // change cursor back:
        cursor.setMouse();
        dc.BackToDeselect();

        AudioSource levelComplete = gameObject.GetComponent <AudioSource> ();

        levelComplete.Play();

        //sound.SetActive (false);
        footsound.mute = true;
        //fingure out how many tools were used
        int usage = PlayerPrefs.GetInt("usage");

        txt.text       = "Number of tools used: " + usage.ToString();
        Time.timeScale = 0;
        if (usage <= par2)
        {
            //if usage is <= par, you get 3 stars
            score2 = 3;
            foreach (GameObject g in starObjects)
            {
                g.SetActive(true);
            }
        }
        else if (usage <= 2 * par2)
        {
            // if usuage is less than 2 times the par, you get 2 stars
            score2 = 2;
            foreach (GameObject g in starObjects)
            {
                Debug.Log(g);
                if (g.name != "star3")
                {
                    Debug.Log(g);
                    g.SetActive(true);
                }
            }
        }
        else
        {
            // if usage is less than 3 times the par, you get 2 stars
            score2 = 1;
            foreach (GameObject g in starObjects)
            {
                if (g.name != "star3" && g.name != "star2")
                {
                    g.SetActive(true);
                }
            }
        }
        score2 = score2 + PlayerPrefs.GetInt("score1");
        PlayerPrefs.SetInt("score2", score2);
        //save the score so far in player prefs for the leaderboard
        lb.savescore(score2);
    }