using OWML.Common; using QSB.OrbSync.TransformSync; using QSB.OrbSync.WorldObjects; using QSB.Utility; using QSB.WorldSync; using QuantumUNET; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace QSB.OrbSync { public class OrbManager : WorldObjectManager { private List _orbs = new List(); protected override void RebuildWorldObjects(OWScene scene) { QSBWorldSync.Init(); DebugLog.DebugWrite($"Finished slot build with {QSBWorldSync.GetWorldObjects().Count()} slots.", MessageType.Success); BuildOrbs(); } private void BuildOrbs() { QSBWorldSync.OldOrbList.Clear(); NomaiOrbTransformSync.OrbTransformSyncs.Clear(); QSBWorldSync.OldOrbList = QSBWorldSync.GetUnityObjects().ToList(); if (QSBCore.IsHost) { _orbs.ForEach(x => QNetworkServer.Destroy(x)); _orbs.Clear(); foreach (var orb in QSBWorldSync.OldOrbList) { var newOrb = Instantiate(QSBNetworkManager.Instance.OrbPrefab); newOrb.SpawnWithServerAuthority(); _orbs.Add(newOrb); } } DebugLog.DebugWrite($"Finished orb build with {QSBWorldSync.OldOrbList.Count} orbs.", MessageType.Success); } } }