3409c53148
Melee combo (left-click / pad-West) becomes the player's primary verb; the ranged projectile is demoted to right-click / pad-left-trigger. Predicted, owner-replicated combo Step (path-dependent -> [GhostField] anchor + absolute-write idempotency, NOT derived like the dash), server-only cleave mirroring ProjectileDamageSystem (SourceTick-stamped DamageEvent + KnockbackState), dash-cancellable movement-commit, 9 live TuningConfig knobs, and swing juice scaling with the combo step. The MC-6 archetype byte is deferred (the melee is its own verb). See DR-030. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
47 lines
2.5 KiB
C#
47 lines
2.5 KiB
C#
using Unity.Collections;
|
|
using Unity.Mathematics;
|
|
using Unity.NetCode;
|
|
|
|
namespace ProjectM.Simulation
|
|
{
|
|
/// <summary>
|
|
/// Twin-stick player input (server-authoritative, input-only clients). Gathered once per frame
|
|
/// on the owning client in <see cref="GhostInputSystemGroup"/> and streamed to the server via
|
|
/// AutoCommandTarget. Netcode source-gen produces InputBufferData<PlayerInput> plus the
|
|
/// copy/apply systems from this type. The [GhostField]s let remote owners be predicted; the
|
|
/// data replays deterministically under rollback.
|
|
/// </summary>
|
|
public struct PlayerInput : IInputComponentData
|
|
{
|
|
/// <summary>WASD / left-stick movement, normalized to roughly -1..1 per axis.</summary>
|
|
[GhostField(Quantization = 1000)] public float2 Move;
|
|
|
|
/// <summary>Right-stick / cursor aim direction (normalized). Zero => face movement direction.</summary>
|
|
[GhostField(Quantization = 1000)] public float2 Aim;
|
|
|
|
/// <summary>Primary ability fire. InputEvent survives the frame→tick→rollback boundary so a press fires exactly once.</summary>
|
|
[GhostField] public InputEvent Fire;
|
|
/// <summary>Dodge dash. InputEvent twin of <see cref="Fire"/>: survives the frame-tick-rollback boundary
|
|
/// so one press dashes exactly once; read by the predicted DashSystem (MC-1).</summary>
|
|
[GhostField] public InputEvent Dash;
|
|
|
|
/// <summary>Melee combo attack (MC-4) - the player's PRIMARY verb. InputEvent twin of Fire/Dash: one press =
|
|
/// one swing attempt across the frame->tick->rollback boundary; read by the predicted MeleeComboSystem.</summary>
|
|
[GhostField] public InputEvent Attack;
|
|
|
|
/// <summary>Active input scheme this tick (<see cref="InputSchemeId"/>: 0 = mouse/keyboard, 1 = gamepad).
|
|
/// The server reads it so the auto-target assist applies only to gamepad shots; precise mouse aim is left
|
|
/// exact. A byte (not an enum): it is compared inside the Burst-compiled <c>AbilityFireSystem</c>.</summary>
|
|
[GhostField] public byte Scheme;
|
|
|
|
public FixedString512Bytes ToFixedString()
|
|
{
|
|
var s = new FixedString512Bytes();
|
|
s.Append(Move.x); s.Append(','); s.Append(Move.y); s.Append(';');
|
|
s.Append(Aim.x); s.Append(','); s.Append(Aim.y); s.Append(';');
|
|
s.Append(Fire.Count); s.Append(';'); s.Append(Scheme); s.Append(';'); s.Append(Dash.Count); s.Append(';'); s.Append(Attack.Count);
|
|
return s;
|
|
}
|
|
}
|
|
}
|