Exemplo n.º 1
0
    private void Update()
    {
        //change shadow and color control day night
        if (PlayerPrefs.GetInt("Day_Night") == 1)
        {
            foreach (var Raw_Image in GameObject.FindGameObjectsWithTag("Change_Color_RawImage"))
            {
                Raw_Image.GetComponent <RawImage>().color = Color_night;

                Raw_Image.GetComponent <Shadow>().effectColor    = Color_night_shadow;
                Raw_Image.GetComponent <Shadow>().effectDistance = new Vector2(Input.acceleration.x / Float_Shadow, Input.acceleration.y / Float_Shadow);
            }

            foreach (var Image in GameObject.FindGameObjectsWithTag("Change_Color_Image"))
            {
                Image.GetComponent <Image>().color           = Color_night;
                Image.GetComponent <Shadow>().effectColor    = Color_night_shadow;
                Image.GetComponent <Shadow>().effectDistance = new Vector2(Input.acceleration.x / Float_Shadow, Input.acceleration.y / Float_Shadow);
            }

            foreach (var Texts in GameObject.FindGameObjectsWithTag("Change_Color_Texts"))
            {
                Texts.GetComponent <TextMeshProUGUI>().color = Color_night;
            }
        }
        else if (PlayerPrefs.GetInt("Day_Night") == 0)
        {
            foreach (var Raw_Image in GameObject.FindGameObjectsWithTag("Change_Color_RawImage"))
            {
                Raw_Image.GetComponent <RawImage>().color        = Color_day;
                Raw_Image.GetComponent <Shadow>().effectDistance = new Vector2(Input.acceleration.x / 8, Input.acceleration.y / Float_Shadow);
            }

            foreach (var Image in GameObject.FindGameObjectsWithTag("Change_Color_Image"))
            {
                Image.GetComponent <Image>().color           = Color_day;
                Image.GetComponent <Shadow>().effectDistance = new Vector2(Input.acceleration.x / 8, Input.acceleration.y / Float_Shadow);
            }

            foreach (var Texts in GameObject.FindGameObjectsWithTag("Change_Color_Texts"))
            {
                Texts.GetComponent <TextMeshProUGUI>().color = Color_day;
            }
        }

        //contorol no color change
        foreach (var Raw_iamge_no_change_color in GameObject.FindGameObjectsWithTag("Just_shadow"))
        {
            Raw_iamge_no_change_color.GetComponent <Shadow>().effectDistance = new Vector2(Input.acceleration.x / Float_Shadow, Input.acceleration.y / Float_Shadow);
        }
    }