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