Class VehicleSpawnerStore
Saves vehicle spawns linked to structures or barricades in the level savedata.
[Priority(-1)]
public class VehicleSpawnerStore : IDisposable
- Inheritance
-
VehicleSpawnerStore
- Implements
- Inherited Members
Remarks
Decided to go with raw binary instead of SQL since this kind of relies on other level savedata and the map, plus it was easier.
Constructors
VehicleSpawnerStore(ILogger<VehicleSpawnerStore>)
public VehicleSpawnerStore(ILogger<VehicleSpawnerStore> logger)
Parameters
loggerILogger<VehicleSpawnerStore>
Properties
Spawns
List of all spawns.
public IReadOnlyList<VehicleSpawnInfo> Spawns { get; }
Property Value
Remarks
Use SaveAsync(CancellationToken) or AddOrUpdateSpawnAsync(VehicleSpawnInfo, CancellationToken) when making changes.
Methods
AddOrUpdateSpawnAsync(VehicleSpawnInfo, CancellationToken)
Add a new spawn or just save the list if it's already in the list.
public UniTask AddOrUpdateSpawnAsync(VehicleSpawnInfo spawnInfo, CancellationToken token = default)
Parameters
spawnInfoVehicleSpawnInfotokenCancellationToken
Returns
- UniTask
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
ReloadSpawners()
public void ReloadSpawners()
RemoveSpawnAsync(VehicleSpawnInfo, CancellationToken)
Remove the given spawn if it's in the list.
public UniTask<bool> RemoveSpawnAsync(VehicleSpawnInfo spawnInfo, CancellationToken token = default)
Parameters
spawnInfoVehicleSpawnInfotokenCancellationToken
Returns
- UniTask<bool>
SaveAsync(CancellationToken)
Save all vehicle spawns to disk.
public UniTask SaveAsync(CancellationToken token = default)
Parameters
tokenCancellationToken
Returns
- UniTask
Events
OnSpawnsReloaded
public event Action? OnSpawnsReloaded