57 lines
1.1 KiB
C#
Raw Normal View History

2021-12-17 19:16:22 -08:00
using QSB.JellyfishSync.TransformSync;
using QSB.Utility;
2021-12-01 01:10:38 -08:00
using QSB.WorldSync;
using QuantumUNET;
using UnityEngine;
namespace QSB.JellyfishSync.WorldObjects
{
public class QSBJellyfish : WorldObject<JellyfishController>
{
public JellyfishTransformSync TransformSync;
private AlignWithTargetBody _alignWithTargetBody;
2021-12-01 01:10:38 -08:00
public override void Init()
2021-12-01 01:10:38 -08:00
{
_alignWithTargetBody = AttachedObject.GetRequiredComponent<AlignWithTargetBody>();
2021-12-01 01:10:38 -08:00
if (QSBCore.IsHost)
{
Object.Instantiate(QSBNetworkManager.Instance.JellyfishPrefab).SpawnWithServerAuthority();
2021-12-01 01:10:38 -08:00
}
StartDelayedReady();
2021-12-17 19:16:22 -08:00
QSBCore.UnityEvents.RunWhen(() => TransformSync, FinishDelayedReady);
2021-12-01 01:10:38 -08:00
}
public override void OnRemoval()
{
if (QSBCore.IsHost)
{
QNetworkServer.Destroy(TransformSync.gameObject);
}
}
2021-12-01 02:23:12 -08:00
public bool IsRising
{
get => AttachedObject._isRising;
set
{
if (AttachedObject._isRising == value)
{
return;
}
2021-12-01 02:23:12 -08:00
AttachedObject._isRising = value;
AttachedObject._attractiveFluidVolume.SetVolumeActivation(!value);
}
}
public bool Align
{
set => _alignWithTargetBody.enabled = value;
}
2021-12-01 01:10:38 -08:00
}
}