mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 22:10:17 +00:00
Cache vehicles
This commit is contained in:
parent
2370a67335
commit
be2e685257
1 changed files with 14 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
using SanAndreasUnity.Importing.Vehicles;
|
||||
using SanAndreasUnity.Utilities;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using VehicleDef = SanAndreasUnity.Importing.Items.Definitions.VehicleDef;
|
||||
|
@ -34,6 +35,9 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
public partial class Vehicle : MonoBehaviour
|
||||
#endif
|
||||
{
|
||||
static List<Vehicle> s_vehicles = new List<Vehicle>();
|
||||
public static IEnumerable<Vehicle> AllVehicles => s_vehicles;
|
||||
|
||||
private static int _sLayer = -1;
|
||||
|
||||
[HideInInspector]
|
||||
|
@ -166,6 +170,16 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
_props = new MaterialPropertyBlock();
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
s_vehicles.Add(this);
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
s_vehicles.Remove(this);
|
||||
}
|
||||
|
||||
public void SetColors(params int[] clrIndices)
|
||||
{
|
||||
for (var i = 0; i < 4 && i < clrIndices.Length; ++i)
|
||||
|
|
Loading…
Reference in a new issue