mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-06 01:00:16 +00:00
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using OWML.Common;
|
|
using QSB.OrbSync.TransformSync;
|
|
using QSB.OrbSync.WorldObjects;
|
|
using QSB.Utility;
|
|
using QSB.WorldSync;
|
|
using QuantumUNET;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
namespace QSB.OrbSync
|
|
{
|
|
public class OrbManager : WorldObjectManager
|
|
{
|
|
protected override void RebuildWorldObjects(OWScene scene)
|
|
{
|
|
QSBWorldSync.Init<QSBOrbSlot, NomaiInterfaceSlot>();
|
|
DebugLog.DebugWrite($"Finished slot build with {QSBWorldSync.GetWorldObjects<QSBOrbSlot>().Count()} slots.", MessageType.Success);
|
|
BuildOrbs();
|
|
}
|
|
|
|
private void BuildOrbs()
|
|
{
|
|
QSBWorldSync.OldOrbList.Clear();
|
|
QSBWorldSync.OldOrbList = Resources.FindObjectsOfTypeAll<NomaiInterfaceOrb>().ToList();
|
|
if (QSBCore.IsServer)
|
|
{
|
|
NomaiOrbTransformSync.OrbTransformSyncs.ForEach(x => QNetworkServer.Destroy(x.gameObject));
|
|
NomaiOrbTransformSync.OrbTransformSyncs.Clear();
|
|
QSBWorldSync.OldOrbList.ForEach(x => QNetworkServer.Spawn(Instantiate(QSBNetworkManager.Instance.OrbPrefab)));
|
|
}
|
|
DebugLog.DebugWrite($"Finished orb build with {QSBWorldSync.OldOrbList.Count} orbs.", MessageType.Success);
|
|
}
|
|
}
|
|
} |