29 lines
801 B
C#
29 lines
801 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace Artngame.TEM
|
|
{
|
|
public class GlobalShaderVariablesTORNADO : MonoBehaviour
|
|
{
|
|
public Transform tornadoTrans;
|
|
|
|
private Camera thisCamera;
|
|
|
|
private void Awake()
|
|
{
|
|
thisCamera = GetComponent<Camera>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
Shader.SetGlobalVector("_CamPos", base.transform.position);
|
|
Shader.SetGlobalVector("_CamRight", base.transform.right);
|
|
Shader.SetGlobalVector("_CamUp", base.transform.up);
|
|
Shader.SetGlobalVector("_CamForward", base.transform.forward);
|
|
Shader.SetGlobalFloat("_AspectRatio", (float)Screen.width / (float)Screen.height);
|
|
Shader.SetGlobalFloat("_FieldOfView", Mathf.Tan(thisCamera.fieldOfView * (MathF.PI / 180f) * 0.5f) * 2f);
|
|
Shader.SetGlobalVector("_TornadoPos", tornadoTrans.position);
|
|
}
|
|
}
|
|
}
|