63 lines
1.5 KiB
C#
63 lines
1.5 KiB
C#
using FishNet.Object.Prediction;
|
|
using UnityEngine;
|
|
using static AffectingForcesManager;
|
|
|
|
namespace ShipHandling
|
|
{
|
|
/// <summary>
|
|
/// Variables for the ship which can also be under the players control.
|
|
/// </summary>
|
|
public class ShipState
|
|
{
|
|
public float BoostCapacity;
|
|
public Vector3 CurrentGravity = new Vector3();
|
|
public float RemainingHealth = 1;
|
|
public bool IsFrozen = false;
|
|
public bool IsFiring = false;
|
|
public Zone Zone;
|
|
}
|
|
|
|
public struct ReplicateData : IReplicateData
|
|
{
|
|
public float Thrust;
|
|
public float Steer;
|
|
public float Boost;
|
|
|
|
public ReplicateData(float thrust, float steer, float boost) : this()
|
|
{
|
|
Thrust = thrust;
|
|
Steer = steer;
|
|
Boost = boost;
|
|
}
|
|
|
|
private uint _tick;
|
|
public void Dispose()
|
|
{
|
|
}
|
|
|
|
public uint GetTick() => _tick;
|
|
|
|
public void SetTick(uint value) => _tick = value;
|
|
}
|
|
|
|
public struct ReconcileData : IReconcileData
|
|
{
|
|
//PredictionRigidbody is used to synchronize rigidbody states
|
|
//and forces. This could be done manually but the PredictionRigidbody
|
|
//type makes this process considerably easier. Velocities, kinematic state,
|
|
//transform properties, pending velocities and more are automatically
|
|
//handled with PredictionRigidbody.
|
|
public PredictionRigidbody PredictionRigidbody;
|
|
|
|
public ReconcileData(PredictionRigidbody pr) : this()
|
|
{
|
|
PredictionRigidbody = pr;
|
|
}
|
|
|
|
private uint _tick;
|
|
public void Dispose() { }
|
|
public uint GetTick() => _tick;
|
|
public void SetTick(uint value) => _tick = value;
|
|
}
|
|
}
|