quantum-space-buddies/QSB/TornadoSync/WorldObjects/QSBTornado.cs
JohnCorby 9e5e7bb6a1 initial state:
- always send from the host
- QSBNetworkBehaviour will store last known data in an array and send that, since real data will be wrong if no authority
2022-02-16 19:22:21 -08:00

37 lines
782 B
C#

using QSB.Messaging;
using QSB.TornadoSync.Messages;
using QSB.WorldSync;
namespace QSB.TornadoSync.WorldObjects
{
public class QSBTornado : WorldObject<TornadoController>
{
public override void SendInitialState(uint to) =>
this.SendMessage(new TornadoFormStateMessage(FormState) { To = to });
public bool FormState
{
get => AttachedObject._tornadoRoot.activeSelf // forming or formed or collapsing
&& !AttachedObject._tornadoCollapsing; // and not collapsing
set
{
if (FormState == value)
{
return;
}
if (value)
{
AttachedObject._tornadoCollapsing = false;
AttachedObject.StartFormation();
}
else
{
AttachedObject._secondsUntilFormation = 0;
AttachedObject.StartCollapse();
}
}
}
}
}