This commit is contained in:
2026-07-04 16:57:40 -07:00
parent 16e396841e
commit c6b7890212
47 changed files with 1713 additions and 209 deletions
@@ -82,6 +82,12 @@ namespace ProjectM.Tests
return q.CalculateEntityCount();
}
static void AdvanceTick(EntityManager em, uint tick)
{
using var q = em.CreateEntityQuery(typeof(NetworkTime));
em.SetComponentData(q.GetSingletonEntity(), new NetworkTime { ServerTick = new NetworkTick(tick) });
}
[Test]
public void Seeds_ByRoomDifficulty_AndSpawnsTaggedAtActiveSlotOrigin()
{
@@ -91,7 +97,11 @@ namespace ProjectM.Tests
var plan = RoomLayoutMath.Plan(map.NodeAt(RunMap.NodeId(0, 0)), 0, map.LayerCount);
int slots = ZoneEnemyMath.WaveSlots(plan.DifficultyEpoch, Bands());
group.Update(); // seeds + first slot spawns this tick
group.Update(); // seeds; the landing grace holds the first slot (demo polish)
Assert.AreEqual(slots, em.GetComponentData<ZoneEnemyState>(zoneDir).RemainingToSpawn,
"grace: nothing spawns on the seed tick");
AdvanceTick(em, T0 + Tuning.RoomEntryGraceTicks + 1);
group.Update(); // grace elapsed -> the first slot drips
var zs = em.GetComponentData<ZoneEnemyState>(zoneDir);
Assert.AreEqual(1, zs.SeededEpoch, "seeded for RoomEpoch 1");
@@ -121,7 +131,9 @@ namespace ProjectM.Tests
var (world, group, runDir, zoneDir) = MakeWorld(bossLayer, map.BossNodeId, activeSubSlot: (byte)(bossLayer & 1));
var em = world.EntityManager;
group.Update();
group.Update(); // seed tick (the landing grace holds the boss)
AdvanceTick(em, T0 + Tuning.RoomEntryGraceTicks + 1);
group.Update(); // grace elapsed -> the boss spawns
var zs = em.GetComponentData<ZoneEnemyState>(zoneDir);
Assert.AreEqual(0, zs.RemainingToSpawn, "a boss room is a single-slot wave, fully spawned");