quantum-space-buddies/QSB/Animation/Player/Thrusters/JetpackAccelerationSync.cs
2021-12-14 21:42:40 -08:00

39 lines
797 B
C#

using QSB.Utility.VariableSync;
using QuantumUNET;
namespace QSB.Animation.Player.Thrusters
{
public class JetpackAccelerationSync : QNetworkBehaviour
{
public Vector3VariableSyncer AccelerationVariableSyncer;
public BoolVariableSyncer ThrustingVariableSyncer;
private ThrusterModel _thrusterModel;
public void Init(ThrusterModel model)
{
_thrusterModel = model;
AccelerationVariableSyncer.Init();
ThrustingVariableSyncer.Init();
}
public void Update()
{
if (IsLocalPlayer)
{
SyncLocalAccel();
}
}
private void SyncLocalAccel()
{
if (_thrusterModel != null)
{
AccelerationVariableSyncer.Value = _thrusterModel.GetLocalAcceleration();
ThrustingVariableSyncer.Value = _thrusterModel.IsTranslationalThrusterFiring();
}
}
}
}