Add prototype gameplay loop with character/battlefield assets and server game APIs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
udx
2026-10-20 18:50:00 +08:00
co-authored by Cursor
parent 79369e4473
commit 6c64210331
833 changed files with 998079 additions and 1042 deletions
+27 -18
View File
@@ -13,35 +13,44 @@ namespace HotUpdate
public static float Height(Vector3 xz, Transform searchRoot = null, float fallback = 0f)
{
Physics.SyncTransforms();
var cols = Collect(searchRoot);
var offsets = new[]
{
Vector3.zero,
new Vector3(0.35f, 0f, 0.35f),
new Vector3(-0.35f, 0f, 0.35f),
new Vector3(0.35f, 0f, -0.35f),
};
foreach (var offset in offsets)
{
if (TryHit(cols, xz + offset, groundOnly: true, out var y))
return y;
}
foreach (var offset in offsets)
{
if (TryHit(cols, xz + offset, groundOnly: false, out var y))
return y;
}
return fallback;
}
static bool TryHit(MeshCollider[] cols, Vector3 xz, bool groundOnly, out float y)
{
var ray = new Ray(new Vector3(xz.x, RayStartY, xz.z), Vector3.down);
var bestDist = float.MaxValue;
var y = fallback;
y = 0f;
var hitAny = false;
foreach (var col in Collect(searchRoot))
foreach (var col in cols)
{
if (col == null || !col.enabled) continue;
if (!IsGroundCollider(col)) continue;
if (groundOnly && !IsGroundCollider(col)) continue;
if (!col.Raycast(ray, out var hit, RayLength)) continue;
if (hit.distance >= bestDist) continue;
bestDist = hit.distance;
y = hit.point.y;
hitAny = true;
}
if (hitAny) return y;
foreach (var col in Collect(searchRoot))
{
if (col == null || !col.enabled) continue;
if (!col.Raycast(ray, out var hit, RayLength)) continue;
if (hit.distance >= bestDist) continue;
bestDist = hit.distance;
y = hit.point.y;
hitAny = true;
}
return hitAny ? y : fallback;
return hitAny;
}
static MeshCollider[] Collect(Transform searchRoot)