void GradientEditorSetter(string GradientName, string GradientLabel, LightColorSetter MaterialSetter)
    {
        VisualElement root = rootVisualElement;
        VisualElement gradientVisualElement = root.Q <VisualElement>(name: GradientName);

        if (gradientVisualElement != null)
        {
            GradientField    gradientField             = gradientVisualElement.Q <GradientField>();
            SerializedObject serialized_MaterialSetter = new SerializedObject(MaterialSetter);
            gradientField.bindingPath = "gradient";
            gradientField.Bind(serialized_MaterialSetter);
            gradientVisualElement.Q <Label>().text = GradientLabel;
        }
    }
Пример #2
0
    void FindElementsToEdit()
    {
        if (GameObject.Find("Lights Controller"))
        {
            TimeController = GameObject.Find("Lights Controller").GetComponent <LightColorController>();
        }

        if (GameObject.Find("Light - Sky") != null)
        {
            skyColorSetter = GameObject.Find("Light - Sky").GetComponent <MaterialColorSetter>();
        }

        if (GameObject.Find("Light - Ruin") != null)
        {
            RuinsColorSetter = GameObject.Find("Light - Ruin").GetComponent <MaterialColorSetter>();
        }

        if (GameObject.Find("Light Group - Tree Tops") != null)
        {
            TreesColorSetter = GameObject.Find("Light Group - Tree Tops").GetComponent <LightColorSetter>();
        }
        if (GameObject.Find("Vegetation Setter - Rim Color") != null)
        {
            RimColorSetter = GameObject.Find("Vegetation Setter - Rim Color").GetComponent <MaterialColorSetter>();
        }
        if (GameObject.Find("Light Group - Sun Spots - 1") != null)
        {
            SunSpot_Group = GameObject.Find("Light Group - Sun Spots - 1").GetComponent <LightColorSetter>();
            if (SunSpot_Group.gameObject.GetComponentsInChildren <Light2D>() != null)
            {
                SunSpots = SunSpot_Group.gameObject.GetComponentsInChildren <Light2D>();
            }
        }

        if (GameObject.Find("Light Group - Grass") != null)
        {
            GrassLight_Group = GameObject.Find("Light Group - Grass").GetComponent <LightColorSetter>();
            if (GrassLight_Group.gameObject.GetComponentInChildren <Light2D>() != null)
            {
                GrassLight = GrassLight_Group.gameObject.GetComponentInChildren <Light2D>();
            }
        }

        if (GameObject.Find("Light - Cave Hole - 1") != null)
        {
            CaveHoleLight = GameObject.Find("Light - Cave Hole - 1").GetComponent <Light2D>();
        }

        if (GameObject.Find("Light Group - Sun Spots - 1") != null)
        {
            GameObject SunSpotsHolder = GameObject.Find("Light Group - Sun Spots - 1");
            if (SunSpotsHolder.GetComponentsInChildren <Light2D>() != null)
            {
                SunSpots = SunSpotsHolder.GetComponentsInChildren <Light2D>();
            }
        }
        WindMaterials = Resources.Load <ScriptableWindMaterial>("WindMaterials").WindMaterials;

        if (GameObject.Find("Volume - Global") != null)
        {
            postprocessingVolume = GameObject.Find("Volume - Global").GetComponent <Volume>();

            postprocessingVolume.sharedProfile.TryGet(out whiteBalanceProperty);
            postprocessingVolume.sharedProfile.TryGet(out BloomProperty);
        }
        if (GameObject.Find("Particles_Glow") != null)
        {
            GlowParticleSystem = GameObject.Find("Particles_Glow").GetComponent <ParticleSystem>();
        }
    }