mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-16 21:08:28 +00:00
add onColorsChanged
event to Vehicle
This commit is contained in:
parent
a5d3c657fc
commit
6adfbcd69c
1 changed files with 8 additions and 4 deletions
|
@ -125,6 +125,8 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
private static readonly int CarEmissionPropertyId = Shader.PropertyToID("_CarEmission");
|
||||
private bool _colorsChanged, _isNightToggled;
|
||||
|
||||
public event System.Action onColorsChanged = delegate {};
|
||||
|
||||
private const float constRearNightIntensity = .7f;
|
||||
|
||||
public bool IsNightToggled
|
||||
|
@ -441,9 +443,14 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
|
||||
private void UpdateMaterials()
|
||||
{
|
||||
if (!_colorsChanged)
|
||||
return;
|
||||
|
||||
_colorsChanged = false;
|
||||
|
||||
UpdateMaterials(_frames, _colors, _lights, _props);
|
||||
|
||||
F.InvokeEventExceptionSafe(this.onColorsChanged);
|
||||
}
|
||||
|
||||
public static void UpdateMaterials(
|
||||
|
@ -530,10 +537,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
}
|
||||
}
|
||||
|
||||
if (_colorsChanged)
|
||||
{
|
||||
UpdateMaterials();
|
||||
}
|
||||
this.UpdateMaterials();
|
||||
|
||||
this.Update_Damage();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue