Exemplo n.º 1
0
    public void SliderChanged(Slider slider)
    {
        mouseOrbitController.disableSteering = true;

        if (objectsParams [currentTargetIndex].materialProperty == "fallIntensity")
        {
            // global param
            UBER_GlobalParams weather_controller = mainCamera.GetComponent <UBER_GlobalParams>();
            weather_controller.fallIntensity = slider.value;
        }
        else if (objectsParams [currentTargetIndex].materialProperty == "_SnowColorAndCoverage")
        {
            Color col = currentMaterial.GetColor("_SnowColorAndCoverage");
            col.a = slider.value;
            currentMaterial.SetColor("_SnowColorAndCoverage", col);
            slider.wholeNumbers = false;
        }
        else if (objectsParams [currentTargetIndex].materialProperty == "SPECIAL_Tiling")
        {
            currentMaterial.SetTextureScale("_MainTex", new Vector2(slider.value, slider.value));
            slider.wholeNumbers = true;
        }
        else
        {
            currentMaterial.SetFloat(objectsParams [currentTargetIndex].materialProperty, slider.value);
            slider.wholeNumbers = false;
        }
    }
 public void SliderChanged(Slider slider)
 {
     this.mouseOrbitController.disableSteering = true;
     if (this.objectsParams[this.currentTargetIndex].materialProperty == "fallIntensity")
     {
         UBER_GlobalParams component = this.mainCamera.GetComponent <UBER_GlobalParams>();
         component.fallIntensity = slider.value;
     }
     else if (this.objectsParams[this.currentTargetIndex].materialProperty == "_SnowColorAndCoverage")
     {
         Color color = this.currentMaterial.GetColor("_SnowColorAndCoverage");
         color.a = slider.value;
         this.currentMaterial.SetColor("_SnowColorAndCoverage", color);
         slider.wholeNumbers = false;
     }
     else if (this.objectsParams[this.currentTargetIndex].materialProperty == "SPECIAL_Tiling")
     {
         this.currentMaterial.SetTextureScale("_MainTex", new Vector2(slider.value, slider.value));
         slider.wholeNumbers = true;
     }
     else
     {
         this.currentMaterial.SetFloat(this.objectsParams[this.currentTargetIndex].materialProperty, slider.value);
         slider.wholeNumbers = false;
     }
 }
    public void SetTemperatureFrost()
    {
        ColorBlock colors = this.buttonSun.colors;

        colors.normalColor    = new Color(1f, 1f, 1f, 0.2f);
        this.buttonSun.colors = colors;
        colors                  = this.buttonFrost.colors;
        colors.normalColor      = new Color(1f, 1f, 1f, 0.7f);
        this.buttonFrost.colors = colors;
        UBER_GlobalParams component = this.mainCamera.GetComponent <UBER_GlobalParams>();

        component.temperature = -20f;
    }
Exemplo n.º 4
0
    public void SetTemperatureFrost()
    {
        ColorBlock cols = buttonSun.colors;

        cols.normalColor = new Color(1, 1, 1, 0.2f);
        buttonSun.colors = cols;

        cols               = buttonFrost.colors;
        cols.normalColor   = new Color(1, 1, 1, 0.7f);
        buttonFrost.colors = cols;
        UBER_GlobalParams weather_controller = mainCamera.GetComponent <UBER_GlobalParams>();

        weather_controller.temperature = -20;
    }
Exemplo n.º 5
0
    public void Start()
    {
        if (UBER_Global_Parameters != null)
        {
            UBER_Global_Parameters.Simulate          = true;
            UBER_Global_Parameters.UseParticleSystem = false;
        }
        else
        {
            UBER_Global_Parameters = FindObjectOfType <UBER_GlobalParams>();

            if (UBER_Global_Parameters != null)
            {
                UBER_Global_Parameters.Simulate          = true;
                UBER_Global_Parameters.UseParticleSystem = false;
            }
            else
            {
                Debug.LogError("Please setup dynamic weather for UBER!");
                this.enabled = false;
            }
        }
    }
Exemplo n.º 6
0
    private void PrepareCurrentObject()
    {
        currentRenderer = objectsParams[currentTargetIndex].renderer;
        if (currentRenderer)
        {
            originalMaterial = currentRenderer.sharedMaterials[objectsParams[currentTargetIndex].submeshIndex];
            if (!(originalMaterial is ProceduralMaterial))
            {
                currentMaterial = Object.Instantiate <Material>(originalMaterial);
            }
            else
            {
                currentMaterial = originalMaterial;
            }
            Material[] mats = currentRenderer.sharedMaterials;
            mats[objectsParams[currentTargetIndex].submeshIndex] = currentMaterial;
            currentRenderer.sharedMaterials = mats;
        }
        bool empty = objectsParams [currentTargetIndex].materialProperty == null || objectsParams [currentTargetIndex].materialProperty == string.Empty;

        if (empty)
        {
            materialSlider.gameObject.SetActive(false);
        }
        else
        {
            materialSlider.gameObject.SetActive(true);
            materialSlider.minValue = objectsParams [currentTargetIndex].SliderRange.x;
            materialSlider.maxValue = objectsParams [currentTargetIndex].SliderRange.y;
            if (objectsParams [currentTargetIndex].materialProperty == "fallIntensity")
            {
                // global param
                UBER_GlobalParams weather_controller = mainCamera.GetComponent <UBER_GlobalParams>();
                materialSlider.value = weather_controller.fallIntensity;
                weather_controller.UseParticleSystem = true;
                buttonSun.gameObject.SetActive(true);
                buttonFrost.gameObject.SetActive(true);
            }
            else
            {
                // material param
                UBER_GlobalParams weather_controller = mainCamera.GetComponent <UBER_GlobalParams> ();
                weather_controller.UseParticleSystem = false;
                buttonSun.gameObject.SetActive(false);
                buttonFrost.gameObject.SetActive(false);
                if (originalMaterial.HasProperty(objectsParams [currentTargetIndex].materialProperty))
                {
                    if (objectsParams[currentTargetIndex].materialProperty == "_SnowColorAndCoverage")
                    {
                        Color col = originalMaterial.GetColor("_SnowColorAndCoverage");
                        materialSlider.value = col.a;
                    }
                    else
                    {
                        materialSlider.value = originalMaterial.GetFloat(objectsParams [currentTargetIndex].materialProperty);
                    }
                }
                else
                {
                    if (objectsParams [currentTargetIndex].materialProperty == "SPECIAL_Tiling")
                    {
                        materialSlider.value = 1;                         // special case - tiling
                    }
                }
            }
        }
        titleTextArea.text       = objectsParams [currentTargetIndex].Title;
        descriptionTextArea.text = objectsParams [currentTargetIndex].Description;
        matParamTextArea.text    = objectsParams [currentTargetIndex].MatParamName;
        Vector2 anchoredPosition = titleTextArea.rectTransform.anchoredPosition;

        anchoredPosition.y = (empty ? 50 : 110) + descriptionTextArea.preferredHeight;
        titleTextArea.rectTransform.anchoredPosition = anchoredPosition;
        //		Debug.Log (descriptionTextArea.preferredHeight);
    }
    private void PrepareCurrentObject()
    {
        this.currentRenderer = this.objectsParams[this.currentTargetIndex].renderer;
        if (this.currentRenderer)
        {
            this.originalMaterial = this.currentRenderer.sharedMaterials[this.objectsParams[this.currentTargetIndex].submeshIndex];
            if (!(this.originalMaterial is ProceduralMaterial))
            {
                this.currentMaterial = UnityEngine.Object.Instantiate <Material>(this.originalMaterial);
            }
            else
            {
                this.currentMaterial = this.originalMaterial;
            }
            Material[] sharedMaterials = this.currentRenderer.sharedMaterials;
            sharedMaterials[this.objectsParams[this.currentTargetIndex].submeshIndex] = this.currentMaterial;
            this.currentRenderer.sharedMaterials = sharedMaterials;
        }
        bool flag = this.objectsParams[this.currentTargetIndex].materialProperty == null || this.objectsParams[this.currentTargetIndex].materialProperty == string.Empty;

        if (flag)
        {
            this.materialSlider.gameObject.SetActive(false);
        }
        else
        {
            this.materialSlider.gameObject.SetActive(true);
            this.materialSlider.minValue = this.objectsParams[this.currentTargetIndex].SliderRange.x;
            this.materialSlider.maxValue = this.objectsParams[this.currentTargetIndex].SliderRange.y;
            if (this.objectsParams[this.currentTargetIndex].materialProperty == "fallIntensity")
            {
                UBER_GlobalParams component = this.mainCamera.GetComponent <UBER_GlobalParams>();
                this.materialSlider.value   = component.fallIntensity;
                component.UseParticleSystem = true;
                this.buttonSun.gameObject.SetActive(true);
                this.buttonFrost.gameObject.SetActive(true);
            }
            else
            {
                UBER_GlobalParams component2 = this.mainCamera.GetComponent <UBER_GlobalParams>();
                component2.UseParticleSystem = false;
                this.buttonSun.gameObject.SetActive(false);
                this.buttonFrost.gameObject.SetActive(false);
                if (this.originalMaterial.HasProperty(this.objectsParams[this.currentTargetIndex].materialProperty))
                {
                    if (this.objectsParams[this.currentTargetIndex].materialProperty == "_SnowColorAndCoverage")
                    {
                        Color color = this.originalMaterial.GetColor("_SnowColorAndCoverage");
                        this.materialSlider.value = color.a;
                    }
                    else
                    {
                        this.materialSlider.value = this.originalMaterial.GetFloat(this.objectsParams[this.currentTargetIndex].materialProperty);
                    }
                }
                else if (this.objectsParams[this.currentTargetIndex].materialProperty == "SPECIAL_Tiling")
                {
                    this.materialSlider.value = 1f;
                }
            }
        }
        this.titleTextArea.text       = this.objectsParams[this.currentTargetIndex].Title;
        this.descriptionTextArea.text = this.objectsParams[this.currentTargetIndex].Description;
        this.matParamTextArea.text    = this.objectsParams[this.currentTargetIndex].MatParamName;
        Vector2 anchoredPosition = this.titleTextArea.rectTransform.anchoredPosition;

        anchoredPosition.y = (float)((!flag) ? 110 : 50) + this.descriptionTextArea.preferredHeight;
        this.titleTextArea.rectTransform.anchoredPosition = anchoredPosition;
    }