2021-03-25 22:01:10 +00:00
|
|
|
|
using System.Collections.Generic;
|
2021-03-23 13:18:29 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace QSB.WorldSync
|
|
|
|
|
{
|
|
|
|
|
public abstract class WorldObjectManager : MonoBehaviour
|
|
|
|
|
{
|
2021-03-25 22:01:10 +00:00
|
|
|
|
private static readonly List<WorldObjectManager> _managers = new List<WorldObjectManager>();
|
2021-03-23 13:18:29 +00:00
|
|
|
|
|
2021-03-25 22:01:10 +00:00
|
|
|
|
public virtual void Awake()
|
2021-03-23 13:18:29 +00:00
|
|
|
|
=> _managers.Add(this);
|
|
|
|
|
|
|
|
|
|
public virtual void OnDestroy()
|
|
|
|
|
=> _managers.Remove(this);
|
|
|
|
|
|
|
|
|
|
public static void Rebuild(OWScene scene)
|
|
|
|
|
{
|
|
|
|
|
foreach (var manager in _managers)
|
|
|
|
|
{
|
|
|
|
|
manager.RebuildWorldObjects(scene);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected abstract void RebuildWorldObjects(OWScene scene);
|
|
|
|
|
}
|
|
|
|
|
}
|