public void UnPause()
 {
     Time.timeScale = 1f;
     audioBackground.transform.GetComponent <AudioSource>().volume = PlayerData.getInstance().volume;
     // capperField.SetActive(false);
     pauseMenuCanvas.SetActive(false);
     PauseBtnCanvas.SetActive(true);
     AudioManager.PlaySound(AudioManager.Audio.click);
 }
    public void Pause()
    {
        audioBackground.transform.GetComponent <AudioSource>().volume = 0;
        AudioManager.PlaySound(AudioManager.Audio.click);
        Time.timeScale = 0f;

        // capperField.SetActive(true);
        pauseMenuCanvas.SetActive(true);
        PauseBtnCanvas.SetActive(false);

        XElement  data; // Данные XML файла
        TextAsset textAsset = (TextAsset)Resources.Load("XML/Lozalization/" + PlayerData.getInstance().lang.ToString() + "/level");

        data = XDocument.Parse(textAsset.text).Element("Level");

        string el = GameRule.TypeAI != GameRule.AI.None ? MenuManager.level.mode.ToString() + "AI" : MenuManager.level.mode.ToString();

        data = data.Element("targets").Element(el);

        goalsTexts[0].transform.GetComponent <Text>().text = data.Element("target1").Value.Replace("NUMBER", GameRule.target1.ToString());
        goalsTexts[1].transform.GetComponent <Text>().text = data.Element("target2").Value.Replace("NUMBER", GameRule.target2.ToString());
        goalsTexts[2].transform.GetComponent <Text>().text = data.Element("target3").Value.Replace("NUMBER", GameRule.target3.ToString());
    }