Initial Combat Implementation
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Unity.Entities;
|
||||
using Unity.NetCode;
|
||||
|
||||
namespace ProjectM.Simulation
|
||||
{
|
||||
/// <summary>
|
||||
/// Predicted per-player ability cooldown gate. Holds the earliest server tick at which the
|
||||
/// owning player may fire again, so <see cref="AbilityFireSystem"/> can throttle shots
|
||||
/// deterministically across client prediction and server simulation.
|
||||
/// <para>
|
||||
/// Replicated as a <see cref="GhostField"/> so the cooldown survives the frame→tick→rollback
|
||||
/// boundary: when the client re-predicts ticks after a snapshot, it sees the same authoritative
|
||||
/// gate the server applied and converges without double-firing. Stored as a raw <c>uint</c>
|
||||
/// rather than a <see cref="NetworkTick"/> for simple, quantization-free serialization; compare
|
||||
/// by wrapping it back into a <see cref="NetworkTick"/> and using
|
||||
/// <see cref="NetworkTick.IsNewerThan"/> (raw subtraction is unsafe across tick wraparound).
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public struct AbilityCooldown : IComponentData
|
||||
{
|
||||
/// <summary>
|
||||
/// Raw tick value of the earliest tick the player may fire again. <c>0</c> = ready (no
|
||||
/// cooldown pending). Set by <see cref="AbilityFireSystem"/> to
|
||||
/// <c>serverTick + max(1, CooldownTicks)</c> on fire; treat as "still cooling down" only
|
||||
/// while a valid <see cref="NetworkTick"/> built from it is newer than the current
|
||||
/// <c>ServerTick</c>.
|
||||
/// </summary>
|
||||
[GhostField] public uint NextFireTick;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user