Shamba

fog_control

Mar 14th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class fog_control : MonoBehaviour {
  6.     public float density = 0;
  7.     public Color fogcolor = Color.blue;
  8.  
  9.     private void OnTriggerEnter(Collider other)
  10.     {
  11.         if(other.tag == "Player")
  12.         {
  13.             RenderSettings.fogColor = fogcolor;
  14.             RenderSettings.fogDensity = density;
  15.             if(this.gameObject.tag == "on")
  16.             {
  17.                 RenderSettings.fog = true;
  18.             }
  19.             else if(this.gameObject.tag == "off")
  20.             {
  21.                 RenderSettings.fog = false;
  22.             }
  23.         }
  24.     }
  25. }
Add Comment
Please, Sign In to add comment