mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 14:00:17 +00:00
add param 'rotateLightsToFaceCamera'
This commit is contained in:
parent
65eb14afad
commit
4aa60fbae4
2 changed files with 10 additions and 5 deletions
|
@ -60,10 +60,13 @@ namespace SanAndreasUnity.Behaviours.World
|
||||||
public GameObject lightSourcePrefab;
|
public GameObject lightSourcePrefab;
|
||||||
|
|
||||||
public float lightScaleMultiplier = 1f;
|
public float lightScaleMultiplier = 1f;
|
||||||
|
|
||||||
public float redTrafficLightDuration = 7;
|
public float redTrafficLightDuration = 7;
|
||||||
public float yellowTrafficLightDuration = 2;
|
public float yellowTrafficLightDuration = 2;
|
||||||
public float greenTrafficLightDuration = 7;
|
public float greenTrafficLightDuration = 7;
|
||||||
|
|
||||||
|
public bool rotateLightsToFaceCamera = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
|
|
|
@ -381,13 +381,15 @@ namespace SanAndreasUnity.Behaviours.World
|
||||||
|
|
||||||
private void UpdateLights()
|
private void UpdateLights()
|
||||||
{
|
{
|
||||||
var cam = Camera.current;
|
if (Cell.Instance.rotateLightsToFaceCamera)
|
||||||
|
|
||||||
if (cam != null)
|
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue