// Start is called before the first frame update
    void Start()
    {
        Sound = GameObject.Find("SoundManager").GetComponent <TestSound>();
        if (PlayerPrefs.GetInt("Music") == 0)
        {
            MusicOn.GetComponent <Button>().interactable  = false;
            MusicOff.GetComponent <Button>().interactable = true;
            Sound.UnMuteMusic("Background");
        }


        else if (PlayerPrefs.GetInt("Music") == 1)
        {
            MusicOn.GetComponent <Button>().interactable  = true;
            MusicOff.GetComponent <Button>().interactable = false;
            Sound.MuteMusic("Background");
        }

        if (PlayerPrefs.GetInt("Sound") == 0)
        {
            SoundOn.GetComponent <Button>().interactable  = false;
            SoundOff.GetComponent <Button>().interactable = true;
            Sound.UnMuteMusic("1");
            Sound.UnMuteMusic("Buzz3");
            Sound.UnMuteMusic("Diamond");
            PlayerPrefs.SetInt("Sound", 0);
        }

        else if (PlayerPrefs.GetInt("Sound") == 1)
        {
            SoundOn.GetComponent <Button>().interactable  = true;
            SoundOff.GetComponent <Button>().interactable = false;
            Sound.MuteMusic("1");
            Sound.MuteMusic("Buzz3");
            Sound.MuteMusic("Diamond");
        }
        CurrentScene = SceneManager.GetActiveScene();
        if (CurrentScene.name == "MainMenu")
        {
            ShopDiamonds.text = PlayerPrefs.GetInt("Diamonds").ToString();
            MainDiamonds.text = PlayerPrefs.GetInt("Diamonds").ToString();
            HighScore.text    = PlayerPrefs.GetInt("HighScore").ToString();
        }
        else
        {
            manager = GameObject.Find("GameManager").GetComponent <GameManager>();
            int back = Random.Range(0, Backgrounds.Length);
            background.GetComponent <Image>().sprite = Backgrounds[back];
        }
    }
    public void Click(string name)
    {
        if (name == "HomeShop")
        {
            Shop.SetActive(false);
        }

        else if (name == "Shop")
        {
            Shop.SetActive(true);
        }

        else if (name == "Play")
        {
            GameManager.gameOn = true;
            SceneManager.LoadScene(1);
        }

        else if (name == "Pause")
        {
            Time.timeScale = 0;
            pauseWindow.SetActive(true);
        }

        else if (name == "Resume")
        {
            Time.timeScale = 1;
            pauseWindow.SetActive(false);
        }

        else if (name == "Retry")
        {
            GameManager.gameOn = true;
            Time.timeScale     = 1;
            SceneManager.LoadScene(1);
        }

        else if (name == "Home")
        {
            Time.timeScale = 1;
            SceneManager.LoadScene(0);
        }

        else if (name == "Settings")
        {
            Settings.SetActive(true);
        }

        else if (name == "Okay")
        {
            Settings.SetActive(false);
        }

        else if (name == "MusicOn")
        {
            MusicOn.GetComponent <Button>().interactable  = true;
            MusicOff.GetComponent <Button>().interactable = false;
            Sound.MuteMusic("Background");
            PlayerPrefs.SetInt("Music", 1);
        }

        else if (name == "MusicOff")
        {
            MusicOn.GetComponent <Button>().interactable  = false;
            MusicOff.GetComponent <Button>().interactable = true;
            Sound.UnMuteMusic("Background");
            PlayerPrefs.SetInt("Music", 0);
        }

        else if (name == "SoundOn")
        {
            SoundOn.GetComponent <Button>().interactable  = true;
            SoundOff.GetComponent <Button>().interactable = false;
            Sound.MuteMusic("1");
            Sound.MuteMusic("Buzz3");
            Sound.MuteMusic("Diamond");
            PlayerPrefs.SetInt("Sound", 1);
        }

        else if (name == "SoundOff")
        {
            SoundOn.GetComponent <Button>().interactable  = false;
            SoundOff.GetComponent <Button>().interactable = true;
            Sound.UnMuteMusic("1");
            Sound.UnMuteMusic("Buzz3");
            Sound.UnMuteMusic("Diamond");
            PlayerPrefs.SetInt("Sound", 0);
        }

        else if (name == "Left")
        {
            left.GetComponent <Button>().interactable  = false;
            right.GetComponent <Button>().interactable = true;
        }
        else if (name == "Right")
        {
            left.GetComponent <Button>().interactable  = true;
            right.GetComponent <Button>().interactable = false;
        }
    }