mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-18 04:10:36 +00:00
39 lines
739 B
C#
39 lines
739 B
C#
|
using QSB.Utility;
|
|||
|
using QuantumUNET;
|
|||
|
using QuantumUNET.Transport;
|
|||
|
using System.Runtime.InteropServices;
|
|||
|
using System.Text;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.Networking;
|
|||
|
|
|||
|
namespace QSB.Animation.Player.Thrusters
|
|||
|
{
|
|||
|
public class JetpackAccelerationSync : QNetworkBehaviour
|
|||
|
{
|
|||
|
[SyncVar]
|
|||
|
private Vector3 _localAcceleration;
|
|||
|
private ThrusterModel _thrusterModel;
|
|||
|
|
|||
|
public Vector3 LocalAcceleration => _localAcceleration;
|
|||
|
|
|||
|
public void Init(ThrusterModel model)
|
|||
|
=> _thrusterModel = model;
|
|||
|
|
|||
|
public void Update()
|
|||
|
{
|
|||
|
if (IsLocalPlayer)
|
|||
|
{
|
|||
|
SyncLocalAccel();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void SyncLocalAccel()
|
|||
|
{
|
|||
|
if (_thrusterModel != null)
|
|||
|
{
|
|||
|
_localAcceleration = _thrusterModel.GetLocalAcceleration();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|