优化 WeaponLance 的攻击逻辑

This commit is contained in:
2026-03-20 09:55:52 +08:00
parent 8d21d53c4d
commit 0d7df18324
16 changed files with 321 additions and 89 deletions
@@ -65,13 +65,15 @@ namespace Simulation
MaxTargets = math.max(1, maxTargets),
ShapeType = CollisionShapeCircle,
Direction = new float3(0f, 0f, 1f),
HalfAngleDeg = 180f
HalfAngleDeg = 180f,
HalfWidth = 0f,
HalfLength = 0f
});
}
private void AddAreaCollisionQuery(int queryId, int sourceEntityId, int sourceOwnerEntityId,
bool sourceWasActiveAtQueryTime, in Vector3 center, float radius, int maxTargets, int shapeType,
in Vector3 direction, float halfAngleDeg)
in Vector3 direction, float halfAngleDeg, float halfWidth, float halfLength)
{
if (!_collisionQueryInputs.IsCreated || radius <= 0f)
{
@@ -101,7 +103,9 @@ namespace Simulation
MaxTargets = math.max(1, maxTargets),
ShapeType = shapeType,
Direction = new float3(normalizedDirection.x, normalizedDirection.y, normalizedDirection.z),
HalfAngleDeg = Mathf.Clamp(halfAngleDeg, 0f, 180f)
HalfAngleDeg = Mathf.Clamp(halfAngleDeg, 0f, 180f),
HalfWidth = Mathf.Max(0f, halfWidth),
HalfLength = Mathf.Max(0f, halfLength)
});
}
@@ -10,6 +10,7 @@ namespace Simulation
private const int CollisionSourceTypeArea = 2;
private const int CollisionShapeCircle = 0;
private const int CollisionShapeSector = 1;
private const int CollisionShapeRectangle = 2;
// Kept as top-level fields because current regression tests reflect them directly.
private NativeList<CollisionQueryData> _collisionQueryInputs;