35 lines
758 B
C#
Raw Normal View History

2022-01-21 15:13:16 -08:00
using QSB.Messaging;
using QSB.TornadoSync.Messages;
using QSB.WorldSync;
2021-12-04 06:21:11 -08:00
2022-03-02 19:46:33 -08:00
namespace QSB.TornadoSync.WorldObjects;
public class QSBTornado : WorldObject<TornadoController>
2021-12-04 06:21:11 -08:00
{
2022-03-02 19:46:33 -08:00
public override void SendInitialState(uint to) =>
this.SendMessage(new TornadoFormStateMessage(FormState) { To = to });
2022-03-02 19:46:33 -08:00
public bool FormState
{
get => AttachedObject._tornadoRoot.activeSelf // forming or formed or collapsing
&& !AttachedObject._tornadoCollapsing; // and not collapsing
set
2021-12-05 03:41:07 -08:00
{
2022-03-02 19:46:33 -08:00
if (FormState == value)
2021-12-05 03:41:07 -08:00
{
2022-03-02 19:46:33 -08:00
return;
}
2021-12-05 20:09:54 -08:00
2022-03-02 19:46:33 -08:00
if (value)
{
AttachedObject._tornadoCollapsing = false;
AttachedObject.StartFormation();
}
else
{
AttachedObject._secondsUntilFormation = 0;
AttachedObject.StartCollapse();
2021-12-05 03:41:07 -08:00
}
}
2021-12-04 06:21:11 -08:00
}
}