Checkpoint 8

1. 统一调度收口为单点 Complete
2. 移除 Job 内部 Complete(),改为返回 JobHandle
3. 修复调度后 NativeList 安全冲突(关键)
  - 将 PrepareEnemyJobOutputBuffer/PrepareProjectileJobOutputBuffer/PrepareEnemySeparationJobBuffers 前置到 BuildInput
  - 互斥候选统计改为读取 _enemyJobInputs,不再在 Complete 前读取 _enemyJobOutputs
4. 新增 CP8 profiler markers
5. 新增回归用例(验证使用最新敌人移动结果构建碰撞候选)
This commit is contained in:
SepComet
2026-02-23 10:53:15 +08:00
parent e6d722ee1d
commit 1a45b513f2
6 changed files with 166 additions and 113 deletions
@@ -535,6 +535,20 @@ namespace Simulation.Tests.Editor
Assert.That(GetCollisionCandidateCount(), Is.GreaterThan(0));
}
[Test]
public void TickProjectiles_BuildsCollisionCandidates_WithLatestEnemyMovement_WhenJobSimulationEnabled()
{
SetUseJobSimulationMethod.Invoke(_worldComponent, new object[] { true });
UpsertEnemy(CreateEnemy(entityId: 5211, position: new Vector3(2f, 0f, 0f), speed: 1f, attackRange: 0.1f));
UpsertProjectile(CreateProjectile(entityId: 5212, position: new Vector3(1f, 0f, 0f),
forward: Vector3.forward, velocity: Vector3.zero, speed: 0f, lifeTime: 2f, age: 0f, active: true,
remainingLifetime: 2f, state: 0));
InvokeTick(deltaTime: 1f, realDeltaTime: 1f, playerPosition: Vector3.zero);
Assert.That(GetCollisionCandidateCount(), Is.GreaterThan(0));
}
[Test]
public void TickProjectiles_ExpiresAfterCollisionCandidateConsumed_WhenJobSimulationEnabled()
{
@@ -565,6 +565,21 @@ namespace Simulation.Tests.PlayMode
yield break;
}
[UnityTest]
public IEnumerator TickProjectiles_BuildsCollisionCandidates_WithLatestEnemyMovement_WhenJobSimulationEnabled()
{
SetUseJobSimulationMethod.Invoke(_worldComponent, new object[] { true });
UpsertEnemy(CreateEnemy(entityId: 5511, position: new Vector3(2f, 0f, 0f), speed: 1f, attackRange: 0.1f));
UpsertProjectile(CreateProjectile(entityId: 5512, position: new Vector3(1f, 0f, 0f),
forward: Vector3.forward, velocity: Vector3.zero, speed: 0f, lifeTime: 2f, age: 0f, active: true,
remainingLifetime: 2f, state: 0));
InvokeTick(deltaTime: 1f, realDeltaTime: 1f, playerPosition: Vector3.zero);
Assert.That(GetCollisionCandidateCount(), Is.GreaterThan(0));
yield break;
}
[UnityTest]
public IEnumerator TickProjectiles_ExpiresAfterCollisionCandidateConsumed_WhenJobSimulationEnabled()
{