mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
33 lines
758 B
C#
33 lines
758 B
C#
using OWML.Common;
|
|
using QSB.Utility;
|
|
using QSB.WorldSync;
|
|
using System.Linq;
|
|
|
|
namespace QSB.TriggerSync
|
|
{
|
|
public class TriggerManager : WorldObjectManager
|
|
{
|
|
public override WorldObjectType WorldObjectType => WorldObjectType.Both;
|
|
|
|
private static TriggerLink[] _triggerLinks;
|
|
|
|
protected override void RebuildWorldObjects(OWScene scene)
|
|
{
|
|
_triggerLinks?.ForEach(x => x.Dispose());
|
|
_triggerLinks = QSBWorldSync.GetUnityObjects<OWTriggerVolume>()
|
|
.Select((x, i) => new TriggerLink(i, x))
|
|
.ToArray();
|
|
}
|
|
|
|
public static TriggerLink GetTriggerLink(int id)
|
|
{
|
|
if (!_triggerLinks.TryGet(id, out var triggerLink))
|
|
{
|
|
DebugLog.ToConsole($"no trigger link with id {id}", MessageType.Error);
|
|
}
|
|
|
|
return triggerLink;
|
|
}
|
|
}
|
|
}
|