2021-12-05 03:41:07 -08:00
|
|
|
|
using QSB.Utility;
|
|
|
|
|
using QSB.WorldSync;
|
2021-12-04 06:21:11 -08:00
|
|
|
|
|
|
|
|
|
namespace QSB.TornadoSync.WorldObjects
|
|
|
|
|
{
|
|
|
|
|
public class QSBTornado : WorldObject<TornadoController>
|
|
|
|
|
{
|
|
|
|
|
public override void Init(TornadoController attachedObject, int id)
|
|
|
|
|
{
|
|
|
|
|
ObjectId = id;
|
|
|
|
|
AttachedObject = attachedObject;
|
|
|
|
|
}
|
2021-12-05 03:41:07 -08:00
|
|
|
|
|
2021-12-05 20:09:54 -08:00
|
|
|
|
public bool FormState
|
2021-12-05 03:41:07 -08:00
|
|
|
|
{
|
2021-12-05 20:09:54 -08:00
|
|
|
|
get => AttachedObject._tornadoRoot.activeSelf // forming or formed or collapsing
|
|
|
|
|
&& !AttachedObject._tornadoCollapsing; // and not collapsing
|
|
|
|
|
set
|
2021-12-05 03:41:07 -08:00
|
|
|
|
{
|
2021-12-05 20:09:54 -08:00
|
|
|
|
if (FormState == value)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (value)
|
|
|
|
|
{
|
|
|
|
|
AttachedObject._tornadoCollapsing = false;
|
|
|
|
|
AttachedObject.StartFormation();
|
|
|
|
|
DebugLog.DebugWrite($"{LogName} form");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AttachedObject._secondsUntilFormation = 0;
|
|
|
|
|
AttachedObject.StartCollapse();
|
|
|
|
|
DebugLog.DebugWrite($"{LogName} collapse");
|
|
|
|
|
}
|
2021-12-05 03:41:07 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-04 06:21:11 -08:00
|
|
|
|
}
|
|
|
|
|
}
|