Files
kronic e362aaeb43 Import art/VFX asset packs + game-feel systems; normalize texture extensions to lowercase for LFS
Add BefourStudios SciFi environment packs, Gabriel Aguiar VFX, and the
ShaderCrew Toon Shader embedded packages, plus combat/enemy/wave/death
gameplay systems and supporting vault docs/screenshots.

Rename 11 vendor textures from uppercase .PNG/.HDR to lowercase so the
case-sensitive Git LFS filters (*.png/*.hdr) match on case-sensitive
filesystems (Linux CI, case-sensitive macOS), not just locally where
core.ignorecase=true masks the gap. Each .meta moved with its asset so
GUID references are preserved. All ~1000 binaries tracked via LFS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 22:50:43 -07:00

37 lines
1.8 KiB
C#

using Unity.Mathematics;
namespace ProjectM.Simulation
{
/// <summary>
/// Pure, deterministic respawn-timer math (no RNG, no wall-clock) — unit-testable in EditMode without a netcode
/// world (mirrors <see cref="PlayerSpawnMath"/> / <see cref="EnemyAIMath"/>). Ticks are the server's monotonic
/// simulation ticks; a stored value of 0 means "no respawn pending / alive". Comparisons use a wrap-safe signed-delta (modular) compare — matching
/// <see cref="Unity.NetCode.NetworkTick.IsNewerThan"/> semantics — so they hold across the uint tick wraparound.
/// </summary>
public static class RespawnMath
{
/// <summary>
/// The tick at which a death at <paramref name="deathTick"/> should respawn, given
/// <paramref name="delayTicks"/> (clamped to &gt;= 1). Never returns 0 (0 is the "no respawn pending"
/// sentinel), so a death exactly at tick 0 still schedules a recovery.
/// </summary>
public static uint RespawnTick(uint deathTick, int delayTicks)
{
uint delay = (uint)math.max(1, delayTicks);
uint t = deathTick + delay;
return t == 0u ? 1u : t;
}
/// <summary>
/// True when <paramref name="now"/> has reached/passed a scheduled <paramref name="respawnTick"/> (and one
/// is actually scheduled, i.e. non-zero).
/// </summary>
public static bool IsDue(uint now, uint respawnTick)
{
// Wrap-safe modular compare (signed delta), NOT a raw `now >= respawnTick` (which is unsafe at the
// uint tick wraparound). Matches NetworkTick.IsNewerThan; keeps this helper pure-uint + unit-testable.
return respawnTick != 0u && (int)(now - respawnTick) >= 0;
}
}
}