mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-04 02:47:22 +00:00
56 lines
1.1 KiB
C#
56 lines
1.1 KiB
C#
using QSB.JellyfishSync.TransformSync;
|
|
using QSB.Utility;
|
|
using QSB.WorldSync;
|
|
using QuantumUNET;
|
|
using UnityEngine;
|
|
|
|
namespace QSB.JellyfishSync.WorldObjects
|
|
{
|
|
public class QSBJellyfish : WorldObject<JellyfishController>
|
|
{
|
|
public JellyfishTransformSync2 TransformSync;
|
|
private AlignWithTargetBody _alignWithTargetBody;
|
|
|
|
public override void Init()
|
|
{
|
|
_alignWithTargetBody = AttachedObject.GetRequiredComponent<AlignWithTargetBody>();
|
|
|
|
if (QSBCore.IsHost)
|
|
{
|
|
Object.Instantiate(QSBNetworkManager.singleton.JellyfishPrefab).SpawnWithServerAuthority();
|
|
}
|
|
|
|
StartDelayedReady();
|
|
QSBCore.UnityEvents.RunWhen(() => TransformSync, FinishDelayedReady);
|
|
}
|
|
|
|
public override void OnRemoval()
|
|
{
|
|
if (QSBCore.IsHost)
|
|
{
|
|
QNetworkServer.Destroy(TransformSync.gameObject);
|
|
}
|
|
}
|
|
|
|
public bool IsRising
|
|
{
|
|
get => AttachedObject._isRising;
|
|
set
|
|
{
|
|
if (AttachedObject._isRising == value)
|
|
{
|
|
return;
|
|
}
|
|
|
|
AttachedObject._isRising = value;
|
|
AttachedObject._attractiveFluidVolume.SetVolumeActivation(!value);
|
|
}
|
|
}
|
|
|
|
public bool Align
|
|
{
|
|
set => _alignWithTargetBody.enabled = value;
|
|
}
|
|
}
|
|
}
|