quantum-space-buddies/QSB/TornadoSync/TornadoManager.cs

45 lines
1.4 KiB
C#
Raw Normal View History

2021-12-06 05:30:04 +00:00
using QSB.Events;
2021-12-04 14:21:11 +00:00
using QSB.TornadoSync.WorldObjects;
using QSB.Utility;
using QSB.WorldSync;
namespace QSB.TornadoSync
{
public class TornadoManager : WorldObjectManager
{
2021-12-06 05:30:04 +00:00
protected override void RebuildWorldObjects(OWScene scene) =>
2021-12-04 14:21:11 +00:00
QSBWorldSync.Init<QSBTornado, TornadoController>();
2021-12-06 05:30:04 +00:00
public static void FireResync()
{
QSBWorldSync.GetWorldObjects<QSBTornado>().ForEach(tornado
=> QSBEventManager.FireEvent(EventNames.QSBTornadoFormState, tornado));
2021-12-04 14:21:11 +00:00
var gdBody = Locator._giantsDeep.GetOWRigidbody();
2021-12-06 05:30:04 +00:00
// cannon
var cannon = Locator._orbitalProbeCannon.GetRequiredComponent<OrbitalProbeLaunchController>();
QSBEventManager.FireEvent(EventNames.QSBBodyResync, cannon.GetAttachedOWRigidbody(), gdBody);
foreach (var fake in cannon._fakeDebrisBodies)
{
if (fake)
{
QSBEventManager.FireEvent(EventNames.QSBBodyResync,
fake.GetAttachedOWRigidbody(), gdBody);
}
}
foreach (var real in cannon._realDebrisSectorProxies)
2021-12-04 14:21:11 +00:00
{
2021-12-06 05:30:04 +00:00
QSBEventManager.FireEvent(EventNames.QSBBodyResync,
real.transform.root.GetAttachedOWRigidbody(), gdBody);
}
2021-12-06 05:30:04 +00:00
QSBEventManager.FireEvent(EventNames.QSBBodyResync, cannon._probeBody, gdBody);
// islands
2021-12-06 05:30:04 +00:00
foreach (var island in QSBWorldSync.GetUnityObjects<IslandController>())
{
2021-12-06 05:30:04 +00:00
QSBEventManager.FireEvent(EventNames.QSBBodyResync, island._islandBody, gdBody);
2021-12-04 14:21:11 +00:00
}
}
}
}