24 lines
524 B
C#
24 lines
524 B
C#
2 months ago
|
using Unity.Netcode;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace BossRoom.Scripts.Shared.Utilities
|
||
|
{
|
||
|
public class WaitForServerStarted : CustomYieldInstruction
|
||
|
{
|
||
|
bool m_IsDone;
|
||
|
|
||
|
public override bool keepWaiting => m_IsDone;
|
||
|
|
||
|
public WaitForServerStarted()
|
||
|
{
|
||
|
void SetDone()
|
||
|
{
|
||
|
NetworkManager.Singleton.OnServerStarted -= SetDone;
|
||
|
m_IsDone = true;
|
||
|
}
|
||
|
|
||
|
NetworkManager.Singleton.OnServerStarted += SetDone;
|
||
|
}
|
||
|
}
|
||
|
}
|