quantum-space-buddies/QSB/EchoesOfTheEye/RaftSync/WorldObjects/QSBRaft.cs
2022-02-25 23:18:47 -08:00

40 lines
846 B
C#

using Cysharp.Threading.Tasks;
using Mirror;
using QSB.EchoesOfTheEye.RaftSync.TransformSync;
using QSB.Utility;
using QSB.WorldSync;
using System.Threading;
using UnityEngine;
namespace QSB.EchoesOfTheEye.RaftSync.WorldObjects;
public class QSBRaft : WorldObject<RaftController>
{
public override bool ShouldDisplayDebug() => false;
public RaftTransformSync TransformSync;
public override async UniTask Init(CancellationToken ct)
{
if (QSBCore.IsHost)
{
Object.Instantiate(QSBNetworkManager.singleton.RaftPrefab).SpawnWithServerAuthority();
}
await UniTask.WaitUntil(() => TransformSync, cancellationToken: ct);
}
public override void OnRemoval()
{
if (QSBCore.IsHost)
{
NetworkServer.Destroy(TransformSync.gameObject);
}
}
public override void SendInitialState(uint to)
{
// todo SendInitialState
}
}