add param 'rotateLightsToFaceCamera'

This commit is contained in:
in0finite 2021-06-25 22:24:46 +02:00
parent 65eb14afad
commit 4aa60fbae4
2 changed files with 10 additions and 5 deletions

View file

@ -60,10 +60,13 @@ namespace SanAndreasUnity.Behaviours.World
public GameObject lightSourcePrefab;
public float lightScaleMultiplier = 1f;
public float redTrafficLightDuration = 7;
public float yellowTrafficLightDuration = 2;
public float greenTrafficLightDuration = 7;
public bool rotateLightsToFaceCamera = true;
private void Awake()

View file

@ -381,13 +381,15 @@ namespace SanAndreasUnity.Behaviours.World
private void UpdateLights()
{
var cam = Camera.current;
if (cam != null)
if (Cell.Instance.rotateLightsToFaceCamera)
{
for (int i = 0; i < m_lightSources.Length; i++)
var cam = Camera.current;
if (cam != null)
{
m_lightSources[i].transform.forward = -cam.transform.forward;
for (int i = 0; i < m_lightSources.Length; i++)
{
m_lightSources[i].transform.forward = -cam.transform.forward;
}
}
}