void Update() { if (Input.GetKeyUp(KeyCode.Escape)) { Application.Quit(); } //Debug.Log("savedMusic: " + PlayerPrefs.GetInt("musicOn") + ", savedSound: " + PlayerPrefs.GetInt("soundOn") + ", musicOn: " + PlaySounds.musicOn + ", soundOn: " + PlaySounds.soundOn); if (Input.GetMouseButtonUp(0)) { if (RaycastFunction(Input.mousePosition) == "ButtonMusic") { Debug.Log("Music Button"); if (!PlaySounds.musicOn) { PlaySounds.musicOn = true; muzikaOff = false; dugmeMuzika.GetComponent <SpriteRenderer>().sprite = dugmeMuzikaSprite; if (PlayerPrefs.HasKey("soundOn")) { if (PlayerPrefs.GetInt("soundOn") == 1) { PlaySounds.Play_Button_MusicOn(); } } PlaySounds.Play_BackgroundMusic_Menu(); PlayerPrefs.SetInt("musicOn", 1); PlayerPrefs.Save(); } else { PlaySounds.musicOn = false; muzikaOff = true; dugmeMuzika.GetComponent <SpriteRenderer>().sprite = dugmeMuzikaOffSprite; PlaySounds.Stop_BackgroundMusic_Menu(); PlayerPrefs.SetInt("musicOn", 0); PlayerPrefs.Save(); } Debug.Log("Music Promena :" + PlayerPrefs.GetInt("musicOn")); Debug.Log("MusicON: " + PlaySounds.musicOn); } else if (RaycastFunction(Input.mousePosition) == "ButtonSound") { Debug.Log("Sound Button"); if (!PlaySounds.soundOn) { PlaySounds.soundOn = true; soundOff = false; dugmeSound.GetComponent <SpriteRenderer>().sprite = dugmeSoundSprite; PlaySounds.Play_Button_SoundOn(); PlayerPrefs.SetInt("soundOn", 1); PlayerPrefs.Save(); } else { PlaySounds.soundOn = false; soundOff = true; dugmeSound.GetComponent <SpriteRenderer>().sprite = dugmeSoundOffSprite; PlayerPrefs.SetInt("soundOn", 0); PlayerPrefs.Save(); } Debug.Log("Sound Promena :" + PlayerPrefs.GetInt("soundOn")); Debug.Log("SoundON: " + PlaySounds.soundOn); } else if (RaycastFunction(Input.mousePosition) == "MainButtonLeaderboard") { Debug.Log("Leaderboard Button"); if (PlaySounds.soundOn) { PlaySounds.Play_Button_SoundOn(); } } else if (RaycastFunction(Input.mousePosition) == "MainButtonResetProgress") { Debug.Log("ResetProgress Button"); if (PlaySounds.soundOn) { PlaySounds.Play_Button_SoundOn(); } } else if (RaycastFunction(Input.mousePosition) == "MainButtonResetTutorial") { Debug.Log("ResetTutorial Button"); if (PlaySounds.soundOn) { PlaySounds.Play_Button_SoundOn(); } } else if (RaycastFunction(Input.mousePosition) == "MainLeaderboardArrow") { Debug.Log("LeaderboardArrow Button"); if (PlaySounds.soundOn) { PlaySounds.Play_Button_SoundOn(); } if (LeaderBoardAktivan) { LeaderBoard.GetComponent <Animation>().Play("MainLeaderboardGo"); } else { LeaderBoard.GetComponent <Animation>().Play("MainLeaderboardShow"); } LeaderBoardAktivan = !LeaderBoardAktivan; } else if (RaycastFunction(Input.mousePosition) == "ButtonLanguage") { Debug.Log("ButtonLanguage Button"); if (PlaySounds.soundOn) { PlaySounds.Play_Button_SoundOn(); } if (LanguagesAktivan) { Zastave.SetActive(false); Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); } else { Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 0; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = 1; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); StartCoroutine("PrikaziZastave"); } LanguagesAktivan = !LanguagesAktivan; } else if (RaycastFunction(Input.mousePosition) == "ButtonFreeCoins") { Debug.Log("ButtonFreeCoins Button"); if (PlaySounds.soundOn) { PlaySounds.Play_Button_SoundOn(); } StartCoroutine(ShopManager.OpenFreeCoinsCard()); } else if (RaycastFunction(Input.mousePosition) == "ButtonShop") { Debug.Log("ButtonShop Button"); if (PlaySounds.soundOn) { PlaySounds.Play_Button_SoundOn(); } StartCoroutine(ShopManager.OpenShopCard()); } else if (RaycastFunction(Input.mousePosition) == "ButtonNews") { Debug.Log("ButtonNews Button"); if (PlaySounds.soundOn) { PlaySounds.Play_Button_SoundOn(); } } else if (RaycastFunction(Input.mousePosition) == "FaceButton") { if (!FacebookManager.Ulogovan) { Debug.Log("LogOut Button"); if (PlaySounds.soundOn) { PlaySounds.Play_Button_SoundOn(); } Face.FacebookLogin(); } } else if (RaycastFunction(Input.mousePosition) == "MainPlayButton") { Debug.Log("Play Button"); if (PlayerPrefs.HasKey("soundOn")) { if (PlayerPrefs.GetInt("soundOn") == 1) { PlaySounds.Play_Button_Play(); } } StartCoroutine(otvoriSledeciNivo()); } else if (RaycastFunction(Input.mousePosition) == "MainLanguageSlideLevo") { Debug.Log("SlideLevo Button"); if (Zastave.transform.position.x <= (GameObject.Find("MainLanguageSlideLevo").transform.position.x - 9f)) { } else { Zastave.transform.Translate(Vector3.left * 0.5f, Space.World); } } else if (RaycastFunction(Input.mousePosition) == "MainLanguageSlideDesno") { Debug.Log("SlideDesno Button"); if (Zastave.transform.position.x >= (GameObject.Find("MainLanguageSlideDesno").transform.position.x - 3.5f)) { } else { Zastave.transform.Translate(Vector3.right * 0.5f, Space.World); } } else if (RaycastFunction(Input.mousePosition) == "Flag1") { Debug.Log("Flag1"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag1").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[0]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 1); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag2") { Debug.Log("Flag2"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag2").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[1]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 2); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag3") { Debug.Log("Flag3"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag3").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[2]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 3); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag4") { Debug.Log("Flag4"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag4").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[3]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 4); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag5") { Debug.Log("Flag5"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag5").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[4]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 5); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag6") { Debug.Log("Flag6"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag6").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[5]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 6); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag7") { Debug.Log("Flag7"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag7").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[6]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 7); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag8") { Debug.Log("Flag8"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag8").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[7]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 8); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag9") { Debug.Log("Flag9"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag9").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[8]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 9); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag10") { Debug.Log("Flag10"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag10").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[9]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 10); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag11") { Debug.Log("Flag11"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag11").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[10]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 11); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag12") { Debug.Log("Flag12"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag12").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[11]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 12); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag13") { Debug.Log("Flag13"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag13").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[12]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 13); PlayerPrefs.Save(); } else if (RaycastFunction(Input.mousePosition) == "Flag14") { Debug.Log("Flag14"); TrenutnaZastava.GetComponent <SpriteRenderer>().sprite = GameObject.Find("Flag14").GetComponent <SpriteRenderer>().sprite; TextJezik.GetComponent <TextMesh>().text = JezikTekst[13]; Zastave.SetActive(false); LanguagesAktivan = false; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].normalizedTime = 1; Languages.GetComponent <Animation>()["MainLanguageFlagsShow"].speed = -1.5f; Languages.GetComponent <Animation>().Play("MainLanguageFlagsShow"); PlayerPrefs.SetInt("LanguageFlag", 14); PlayerPrefs.Save(); } } }