Files
Project-M/Assets/_Project/Scripts/Simulation/Combat/DamageEvent.cs
T
2026-05-31 21:35:12 -07:00

21 lines
979 B
C#

using Unity.Entities;
namespace ProjectM.Simulation
{
/// <summary>
/// One pending hit against a damageable entity, queued as a per-entity buffer element. The server
/// appends a DamageEvent when a projectile hits (ProjectileDamageSystem), then HealthApplyDamageSystem
/// drains the buffer once per tick to subtract from Health. Buffering decouples hit detection from
/// health resolution and lets multiple simultaneous hits accumulate before being applied. Not
/// replicated — only Health.Current is a GhostField; the buffer is server-side and cleared each tick.
/// </summary>
public struct DamageEvent : IBufferElementData
{
/// <summary>Damage to subtract from the target's Health.Current (world health units).</summary>
public float Amount;
/// <summary>NetworkId of the firing player that caused this hit (attribution / self-hit filtering upstream).</summary>
public int SourceNetworkId;
}
}