mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2024-12-29 03:28:26 +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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|