多轮审查和修复

This commit is contained in:
2026-05-12 15:34:08 +08:00
parent f55d2a57c3
commit ebbbb7332e
805 changed files with 838724 additions and 1905 deletions

View File

@@ -48,6 +48,17 @@ namespace BaseGames.Enemies.Navigation
{
if (_movement != null) _movement.movementSpeed = speed;
}
public bool IsNearEdge()
{
// 双射线检测:脚下前方是否有地面
if (_navAgent == null) return false;
var origin = (Vector2)transform.position;
var facing = transform.localScale.x >= 0f ? Vector2.right : Vector2.left;
var groundMask = ~0; // 检测所有层;可收窄至 Ground 层
bool groundAhead = Physics2D.Raycast(origin + facing * 0.3f, Vector2.down, 0.5f, groundMask);
return !groundAhead;
}
}
}