Advertisement
ArenMook

Purple psychedelic environment

Feb 6th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.48 KB | None | 0 0
  1. RuntimeBehaviour.Create().onUpdate = delegate(RuntimeBehaviour rb)
  2. {
  3.     if (UILoadingScreen.isVisible) return;
  4.     rb.onUpdate = null;
  5.  
  6.     float reflectionTint = 0.2f;
  7.     Color ambientLight = new Color(0.3f, 0.2f, 0.1f);
  8.     Color water0 = new Color(2f, 0f, 1f, 1f);
  9.     Color water1 = new Color(0.5f, 0f, 1f, 0.5f);
  10.    
  11.     Color willow0 = new Color(1f, 0.5f, 1f, 1f);
  12.     Color willow1 = new Color(0f, 0f, 0f, 1f);
  13.     Color spruce0 = new Color(0.32f, 0.15f, 0.5f, 1f);
  14.     Color spruce1 = new Color(0f, 0f, 0f, 1f);
  15.    
  16.     string slopeTexture = "Textures/Temperate 0 C";
  17.     string slopeNormal = "Textures/Temperate 0 CN";
  18.     string shoreTexture = "Textures/Temperate 1 A";
  19.     string grassTexture = "Textures/Purple Repeat";
  20.     string hillTexture = "Textures/Temperate 2 G";
  21.  
  22.     GameObject go = GameObject.Find("Procedural Zone");
  23.     PaintTerrain paint = go.transform.GetComponentInChildren<PaintTerrain>();
  24.     paint.slopeTexture = ResourceLoader.LoadTexture(slopeTexture, true);
  25.     paint.slopeNormal = ResourceLoader.LoadTexture(slopeNormal, true);
  26.     paint.shoreTexture = ResourceLoader.LoadTexture(shoreTexture, true);
  27.     paint.grassTexture = ResourceLoader.LoadTexture(grassTexture, true);
  28.     paint.hillTexture = ResourceLoader.LoadTexture(hillTexture, true);
  29.     paint.Repaint();
  30.  
  31.     RenderSettings.ambientLight = ambientLight;
  32.    
  33.     if (TasharenWater.instance != null)
  34.     {
  35.         Renderer ren = TasharenWater.instance.GetComponent<Renderer>();
  36.         Material mat = ren.material;
  37.         mat.SetColor("_Color0", water0);
  38.         mat.SetColor("_Color1", water1);
  39.         mat.SetFloat("_ReflectionTint", reflectionTint);
  40.     }
  41.  
  42.     RuntimeBehaviour rb2 = RuntimeBehaviour.Create("TexUpdate");
  43.     ZoneCreator.onTerrainModified -= rb2.Custom;
  44.  
  45.     rb2.onCustom = delegate(RuntimeBehaviour r)
  46.     {
  47.         RuntimeBehaviour.Create().onUpdate = delegate(RuntimeBehaviour rb3)
  48.         {
  49.             if (UILoadingScreen.isVisible) return;
  50.             rb3.onUpdate = null;
  51.  
  52.             Renderer[] rens = GameObject.Find("Trees").GetComponentsInChildren<Renderer>();
  53.  
  54.             foreach (Renderer ren in rens)
  55.             {
  56.                 Material mat = ren.material;
  57.  
  58.                 if (mat.name.StartsWith("Willow"))
  59.                 {
  60.                     mat.SetColor("_Color", willow0);
  61.                     mat.SetColor("_Secondary", willow1);
  62.                 }
  63.                 else if (mat.name.StartsWith("Spruce"))
  64.                 {
  65.                     mat.SetColor("_Color", spruce0);
  66.                     mat.SetColor("_Secondary", spruce1);
  67.                 }
  68.             }
  69.         };
  70.     };
  71.  
  72.     rb2.onDestroy = delegate(RuntimeBehaviour r)
  73.     {
  74.         ZoneCreator.onTerrainModified -= r.Custom;
  75.     };
  76.  
  77.     if (rb2.onCustom != null) rb2.Custom();
  78.  
  79.     ZoneCreator.onTerrainModified += rb2.Custom;
  80. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement