Ejemplo n.º 1
0
    public void ChangeVibration()
    {
        var currentValue = PlayerPrefs.GetInt("Vibration");

        VibrationOption.GetComponent <Image>().sprite = currentValue == 0 ? IsOn : IsOff;
        PlayerPrefs.SetInt("Vibration", currentValue == 0 ? 1 : 0);
    }
Ejemplo n.º 2
0
    void Start()
    {
        Language  = (Enums.Languages)Enum.Parse(typeof(Enums.Languages), PlayerPrefs.GetString("Language", "EU"));
        Music     = PlayerPrefs.GetInt("Music", 1);
        Sounds    = PlayerPrefs.GetInt("Sounds", 1);
        Vibration = PlayerPrefs.GetInt("Vibration", 1);

        SoundsOption    = GameObject.Find("SoundsOption").gameObject;
        MusicOption     = GameObject.Find("MusicOption").gameObject;
        VibrationOption = GameObject.Find("VibrationOption").gameObject;
        LanguageOption  = GameObject.Find("LanguageOption").gameObject;

        SoundsOption.GetComponent <Image>().sprite    = Sounds == 1 ? IsOn : IsOff;
        MusicOption.GetComponent <Image>().sprite     = Music == 1 ? IsOn : IsOff;
        VibrationOption.GetComponent <Image>().sprite = Vibration == 1 ? IsOn : IsOff;

        LanguageOption.GetComponent <Image>().sprite = Flags[(int)Language];
    }