using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[ExecuteInEditMode]
|
|
public class CustomFog : MonoBehaviour
|
|
{
|
|
public float FogHeightStart = 0;
|
|
public float FogHeightEnd = 30;
|
|
public Color FogColor = Color.white;
|
|
|
|
void Awake()
|
|
{
|
|
UpdateFog();
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
void UpdateFog()
|
|
{
|
|
if (FogHeightStart > (FogHeightEnd - 1))
|
|
FogHeightStart = FogHeightEnd - 1;
|
|
|
|
Shader.SetGlobalFloat("_GlobalFogHeightStart", FogHeightStart);
|
|
Shader.SetGlobalFloat("_GlobalFogHeightEnd", FogHeightEnd);
|
|
}
|
|
}
|