quantum-space-buddies/QSB/PoolSync/PoolManager.cs

47 lines
1.3 KiB
C#
Raw Normal View History

2022-01-29 04:49:07 +00:00
using Cysharp.Threading.Tasks;
2022-02-21 21:02:58 +00:00
using QSB.Utility;
2022-01-29 04:49:07 +00:00
using QSB.WorldSync;
using System.Threading;
2022-03-03 03:46:33 +00:00
namespace QSB.PoolSync;
internal class PoolManager : WorldObjectManager
{
2022-03-03 03:46:33 +00:00
public override WorldObjectScene WorldObjectScene => WorldObjectScene.SolarSystem;
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct)
{
2022-03-03 03:46:33 +00:00
foreach (var streaming in QSBWorldSync.GetUnityObjects<NomaiRemoteCameraStreaming>().SortDeterministic())
{
streaming.gameObject.AddComponent<CustomNomaiRemoteCameraStreaming>();
}
foreach (var camera in QSBWorldSync.GetUnityObjects<NomaiRemoteCamera>().SortDeterministic())
{
camera.gameObject.AddComponent<CustomNomaiRemoteCamera>();
}
foreach (var platform in QSBWorldSync.GetUnityObjects<NomaiRemoteCameraPlatform>().SortDeterministic())
{
platform.gameObject.AddComponent<CustomNomaiRemoteCameraPlatform>();
}
}
public override void UnbuildWorldObjects()
{
foreach (var platform in QSBWorldSync.GetUnityObjects<CustomNomaiRemoteCameraPlatform>())
{
Destroy(platform);
}
2022-03-03 03:46:33 +00:00
foreach (var camera in QSBWorldSync.GetUnityObjects<CustomNomaiRemoteCamera>())
{
2022-03-03 03:46:33 +00:00
Destroy(camera);
}
2022-03-03 03:46:33 +00:00
foreach (var streaming in QSBWorldSync.GetUnityObjects<CustomNomaiRemoteCameraStreaming>())
{
2022-03-03 03:46:33 +00:00
Destroy(streaming);
}
}
}