Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RuntimeBehaviour.Create().onUpdate = delegate(RuntimeBehaviour rb)
- {
- if (UILoadingScreen.isVisible) return;
- rb.onUpdate = null;
- float reflectionTint = 0.2f;
- Color ambientLight = new Color(0.3f, 0.2f, 0.1f);
- Color water0 = new Color(2f, 0f, 1f, 1f);
- Color water1 = new Color(0.5f, 0f, 1f, 0.5f);
- Color willow0 = new Color(1f, 0.5f, 1f, 1f);
- Color willow1 = new Color(0f, 0f, 0f, 1f);
- Color spruce0 = new Color(0.32f, 0.15f, 0.5f, 1f);
- Color spruce1 = new Color(0f, 0f, 0f, 1f);
- string slopeTexture = "Textures/Temperate 0 C";
- string slopeNormal = "Textures/Temperate 0 CN";
- string shoreTexture = "Textures/Temperate 1 A";
- string grassTexture = "Textures/Purple Repeat";
- string hillTexture = "Textures/Temperate 2 G";
- GameObject go = GameObject.Find("Procedural Zone");
- PaintTerrain paint = go.transform.GetComponentInChildren<PaintTerrain>();
- paint.slopeTexture = ResourceLoader.LoadTexture(slopeTexture, true);
- paint.slopeNormal = ResourceLoader.LoadTexture(slopeNormal, true);
- paint.shoreTexture = ResourceLoader.LoadTexture(shoreTexture, true);
- paint.grassTexture = ResourceLoader.LoadTexture(grassTexture, true);
- paint.hillTexture = ResourceLoader.LoadTexture(hillTexture, true);
- paint.Repaint();
- RenderSettings.ambientLight = ambientLight;
- if (TasharenWater.instance != null)
- {
- Renderer ren = TasharenWater.instance.GetComponent<Renderer>();
- Material mat = ren.material;
- mat.SetColor("_Color0", water0);
- mat.SetColor("_Color1", water1);
- mat.SetFloat("_ReflectionTint", reflectionTint);
- }
- RuntimeBehaviour rb2 = RuntimeBehaviour.Create("TexUpdate");
- ZoneCreator.onTerrainModified -= rb2.Custom;
- rb2.onCustom = delegate(RuntimeBehaviour r)
- {
- RuntimeBehaviour.Create().onUpdate = delegate(RuntimeBehaviour rb3)
- {
- if (UILoadingScreen.isVisible) return;
- rb3.onUpdate = null;
- Renderer[] rens = GameObject.Find("Trees").GetComponentsInChildren<Renderer>();
- foreach (Renderer ren in rens)
- {
- Material mat = ren.material;
- if (mat.name.StartsWith("Willow"))
- {
- mat.SetColor("_Color", willow0);
- mat.SetColor("_Secondary", willow1);
- }
- else if (mat.name.StartsWith("Spruce"))
- {
- mat.SetColor("_Color", spruce0);
- mat.SetColor("_Secondary", spruce1);
- }
- }
- };
- };
- rb2.onDestroy = delegate(RuntimeBehaviour r)
- {
- ZoneCreator.onTerrainModified -= r.Custom;
- };
- if (rb2.onCustom != null) rb2.Custom();
- ZoneCreator.onTerrainModified += rb2.Custom;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement