61 lines
1.3 KiB
C#
61 lines
1.3 KiB
C#
using UnityEngine;
|
|
|
|
[DisallowMultipleComponent]
|
|
[ExecuteInEditMode]
|
|
[RequireComponent(typeof(MeshRenderer))]
|
|
public class AGGlobalSettings : MonoBehaviour
|
|
{
|
|
[Range(0f, 2f)]
|
|
[Header("Trees Settings")]
|
|
public float AOIntensity = 1f;
|
|
|
|
[Range(0f, 2f)]
|
|
public float TranslucencyIntensity = 1f;
|
|
|
|
public float TranslucencyDistance = 200f;
|
|
|
|
[Space(20f)]
|
|
public bool EnableTintColor = true;
|
|
|
|
private float TintToggle;
|
|
|
|
public Texture2D TintNoiseTexture;
|
|
|
|
[Range(0.001f, 10f)]
|
|
public float TintNoiseTile = 1f;
|
|
|
|
[Range(0.001f, 10f)]
|
|
public float TintNoiseContrast = 1f;
|
|
|
|
private void Awake()
|
|
{
|
|
if (Application.isPlaying)
|
|
{
|
|
base.gameObject.GetComponent<MeshRenderer>().enabled = false;
|
|
}
|
|
else
|
|
{
|
|
base.gameObject.GetComponent<MeshRenderer>().enabled = true;
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (EnableTintColor)
|
|
{
|
|
TintToggle = 1f;
|
|
}
|
|
else
|
|
{
|
|
TintToggle = 0f;
|
|
}
|
|
Shader.SetGlobalFloat("AG_TreesAO", AOIntensity);
|
|
Shader.SetGlobalFloat("AG_TranslucencyIntensity", TranslucencyIntensity);
|
|
Shader.SetGlobalFloat("AG_TranslucencyDistance", TranslucencyDistance);
|
|
Shader.SetGlobalTexture("AG_TintNoiseTexture", TintNoiseTexture);
|
|
Shader.SetGlobalFloat("AG_TintToggle", TintToggle);
|
|
Shader.SetGlobalFloat("AG_TintNoiseTile", TintNoiseTile);
|
|
Shader.SetGlobalFloat("AG_TintNoiseContrast", TintNoiseContrast);
|
|
}
|
|
}
|