Shamba

fog_control

Mar 12th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 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.  
  8.     private void OnTriggerEnter(Collider other)
  9.     {
  10.         if(other.tag == "Player")
  11.         {
  12.             RenderSettings.fogColor = Color.blue;
  13.             RenderSettings.fogDensity = density;
  14.             if(this.gameObject.tag == "on")
  15.             {
  16.                 RenderSettings.fog = true;
  17.             }
  18.             else if(this.gameObject.tag == "off")
  19.             {
  20.                 RenderSettings.fog = false;
  21.             }
  22.         }
  23.     }
  24. }
Add Comment
Please, Sign In to add comment