Esempio n. 1
0
    void Update()
    {
        MeshRenderer renderer = this.gameObject.GetComponent <MeshRenderer>();

        renderer.material.SetColor("_PointLightColor", sun.color);
        renderer.material.SetVector("_PointLightPosition", sun.GetWorldPosition());
    }
Esempio n. 2
0
 private void Update()
 {
     // Pass updated light positions to shader
     renderer = GetComponent <Renderer>();
     renderer.material.SetColor("_PointLightColor", pointLight.color);
     renderer.material.SetVector("_PointLightPosition", pointLight.GetWorldPosition());
 }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        // Pass updated light positions to shader
        MeshRenderer renderer = _terrain.GetComponent <MeshRenderer>();

        renderer.material.SetColor("_PointLightColor", sun.color);
        renderer.material.SetVector("_PointLightPosition", sun.GetWorldPosition());
    }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        float terrainWidth = terrain.findWidth(terrain.nverts);
        //set water plane height relative to terrain height
        float waterHeight = 0.24f * terrain.totalHeight + terrain.findMinHeight(terrain.nverts);

        this.transform.position = new Vector3(0, waterHeight, 0);
        transform.localScale    = new Vector3(terrainWidth / scaleToTerrainWidthRatio, 1, terrainWidth / scaleToTerrainWidthRatio);
        //print(terrainWidth / scaleToTerrainWidthRatio);
        SetColour();

        //pass information for phong shader
        renderer = GetComponent <Renderer>();
        renderer.material.SetColor("_PointLightColor", pointLight.color);
        renderer.material.SetVector("_PointLightPosition", pointLight.GetWorldPosition());
    }