From 2c51ec4a368aff6fd15f12a21b74ce04f1e40834 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Thu, 17 Feb 2022 04:43:57 -0800 Subject: [PATCH] tweak --- QSB/Player/JoinLeaveSingularity.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/QSB/Player/JoinLeaveSingularity.cs b/QSB/Player/JoinLeaveSingularity.cs index ec4f65cc..e58a03ea 100644 --- a/QSB/Player/JoinLeaveSingularity.cs +++ b/QSB/Player/JoinLeaveSingularity.cs @@ -25,12 +25,12 @@ namespace QSB.Player return; } - DebugLog.DebugWrite($"WARP TASK {player.PlayerId}"); - var go = new GameObject(nameof(JoinLeaveSingularity)); var ct = go.GetCancellationTokenOnDestroy(); UniTask.Create(async () => { + DebugLog.DebugWrite($"WARP TASK {player.PlayerId}"); + await Run(go.transform, player, joining, ct).SuppressCancellationThrow(); Object.Destroy(go); @@ -125,17 +125,16 @@ namespace QSB.Player effect.WarpObjectOut(0); } - var tcs = new UniTaskCompletionSource(); - effect.OnWarpComplete += () => tcs.TrySetResult(); - await tcs.Task.AttachExternalCancellation(ct); - DebugLog.DebugWrite($"WARP DONE {player.PlayerId}"); - - if (!joining) + effect.OnWarpComplete += () => { - Object.Destroy(fakePlayer); - } + DebugLog.DebugWrite($"WARP DONE {player.PlayerId}"); - await UniTask.WaitUntil(() => !singularity._owOneShotSource.isPlaying, cancellationToken: ct); + if (!joining) + { + Object.Destroy(fakePlayer); + } + }; + await UniTask.WaitUntil(() => !effect.enabled && !singularity._owOneShotSource.isPlaying, cancellationToken: ct); } } }