mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-30 12:32:55 +00:00
make AllObjectsAdded and AllObjectsReady non-computed again
This commit is contained in:
parent
835f495247
commit
bcc87190a3
@ -21,11 +21,11 @@ namespace QSB.WorldSync
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set when all WorldObjectManagers have called Init() on all their objects (AKA all the objects are created)
|
/// Set when all WorldObjectManagers have called Init() on all their objects (AKA all the objects are created)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool AllObjectsAdded => _managerTasks.Count == 0;
|
public static bool AllObjectsAdded { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set when all WorldObjects have finished running Init()
|
/// Set when all WorldObjects have finished running Init()
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool AllObjectsReady => _objectTasks.Count == 0;
|
public static bool AllObjectsReady { get; private set; }
|
||||||
|
|
||||||
private static CancellationTokenSource _cts;
|
private static CancellationTokenSource _cts;
|
||||||
private static readonly List<UniTask> _managerTasks = new();
|
private static readonly List<UniTask> _managerTasks = new();
|
||||||
@ -68,10 +68,12 @@ namespace QSB.WorldSync
|
|||||||
|
|
||||||
await _managerTasks;
|
await _managerTasks;
|
||||||
_managerTasks.Clear();
|
_managerTasks.Clear();
|
||||||
|
AllObjectsAdded = true;
|
||||||
DebugLog.DebugWrite("World Objects added.", MessageType.Success);
|
DebugLog.DebugWrite("World Objects added.", MessageType.Success);
|
||||||
|
|
||||||
await _objectTasks;
|
await _objectTasks;
|
||||||
_objectTasks.Clear();
|
_objectTasks.Clear();
|
||||||
|
AllObjectsReady = true;
|
||||||
DebugLog.DebugWrite("World Objects ready.", MessageType.Success);
|
DebugLog.DebugWrite("World Objects ready.", MessageType.Success);
|
||||||
|
|
||||||
DeterministicManager.WorldObjectsReady();
|
DeterministicManager.WorldObjectsReady();
|
||||||
@ -93,10 +95,12 @@ namespace QSB.WorldSync
|
|||||||
_cts.Dispose();
|
_cts.Dispose();
|
||||||
_cts = null;
|
_cts = null;
|
||||||
|
|
||||||
GameReset();
|
|
||||||
|
|
||||||
_managerTasks.Clear();
|
_managerTasks.Clear();
|
||||||
_objectTasks.Clear();
|
_objectTasks.Clear();
|
||||||
|
AllObjectsAdded = false;
|
||||||
|
AllObjectsReady = false;
|
||||||
|
|
||||||
|
GameReset();
|
||||||
|
|
||||||
foreach (var item in WorldObjects)
|
foreach (var item in WorldObjects)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user