mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-21 00:39:53 +00:00
JoinLeaveSingularity: use Try, and nicer logging
This commit is contained in:
parent
2c51ec4a36
commit
7207211454
@ -25,16 +25,17 @@ namespace QSB.Player
|
||||
return;
|
||||
}
|
||||
|
||||
var go = new GameObject(nameof(JoinLeaveSingularity));
|
||||
var go = new GameObject($"player {player.PlayerId} JoinLeaveSingularity");
|
||||
var ct = go.GetCancellationTokenOnDestroy();
|
||||
UniTask.Create(async () =>
|
||||
{
|
||||
DebugLog.DebugWrite($"WARP TASK {player.PlayerId}");
|
||||
DebugLog.DebugWrite($"{go.name}: WARP TASK");
|
||||
|
||||
await Run(go.transform, player, joining, ct).SuppressCancellationThrow();
|
||||
await go.name.Try("running warp task",
|
||||
() => Run(go.transform, player, joining, ct));
|
||||
Object.Destroy(go);
|
||||
|
||||
DebugLog.DebugWrite($"WARP TASK DONE {player.PlayerId}");
|
||||
DebugLog.DebugWrite($"{go.name}: WARP TASK DONE");
|
||||
});
|
||||
}
|
||||
|
||||
@ -116,18 +117,18 @@ namespace QSB.Player
|
||||
if (joining)
|
||||
{
|
||||
player.Body.SetActive(true);
|
||||
DebugLog.DebugWrite($"WARP IN {player.PlayerId}");
|
||||
DebugLog.DebugWrite($"{transform.name}: WARP IN");
|
||||
effect.WarpObjectIn(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugLog.DebugWrite($"WARP OUT {player.PlayerId}");
|
||||
DebugLog.DebugWrite($"{transform.name}: WARP OUT");
|
||||
effect.WarpObjectOut(0);
|
||||
}
|
||||
|
||||
effect.OnWarpComplete += () =>
|
||||
{
|
||||
DebugLog.DebugWrite($"WARP DONE {player.PlayerId}");
|
||||
DebugLog.DebugWrite($"{transform.name}: WARP DONE");
|
||||
|
||||
if (!joining)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user