初次提交
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// BulletManagerCs — 子弹 SoA 热路径 C# 内核(S0 骨架)
|
||||
// S0 范围:帧时间监控 + AsSpan() 沟通基线验证
|
||||
// 完整积分热路径在 S1 展开(见 development_plan.md S1)
|
||||
// ADR-L1 规厙1:内层循环禁止 Call() | 规厙2:热数据通过 AsSpan() 零拷贝
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class BulletManagerCs : Node
|
||||
{
|
||||
private GodotObject _gdBulletManager;
|
||||
|
||||
// S0 性能计时(P-S0-07 帧预算回填)
|
||||
private double _accumMs;
|
||||
private int _frames;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_gdBulletManager = Engine.GetSingleton("BulletManager");
|
||||
// S0 骨架不接管积分,保持 _cs_node = null,让 GDScript fallback 运行
|
||||
GD.Print("[BulletManagerCs] S0 骨架就绪,GDScript fallback 活跞");
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
if (_gdBulletManager is null) return;
|
||||
var t0 = Time.GetTicksUsec();
|
||||
|
||||
// S0:仅记录帧时间(积分由 GDScript fallback 负责)
|
||||
var activeCount = _gdBulletManager.Get("_active_count").AsInt32();
|
||||
_ = activeCount;
|
||||
|
||||
_accumMs += (Time.GetTicksUsec() - t0) / 1000.0;
|
||||
_frames++;
|
||||
if (_frames >= 60)
|
||||
{
|
||||
GD.Print($"[BulletManagerCs] 帧时间均倦: {_accumMs / _frames:F3} ms " +
|
||||
$"(active={activeCount} TODO S1: 启用完整热路径)");
|
||||
_accumMs = 0; _frames = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://d305dubg5veqd
|
||||
@@ -0,0 +1,36 @@
|
||||
// EnemyManagerCs — 敌人 SoA 热路径 C# 内核(S0 骨架)
|
||||
// S0 范围:帧时间监控,完整 Boid 积分在 S1 展开
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class EnemyManagerCs : Node
|
||||
{
|
||||
private GodotObject _gdEnemyManager;
|
||||
private double _accumMs;
|
||||
private int _frames;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_gdEnemyManager = Engine.GetSingleton("EnemyManager");
|
||||
// S0 骨架不接管积分,保持 _cs_node = null,让 GDScript fallback 运行
|
||||
GD.Print("[EnemyManagerCs] S0 骨架就绪,GDScript fallback 活跞");
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
if (_gdEnemyManager is null) return;
|
||||
var t0 = Time.GetTicksUsec();
|
||||
|
||||
var activeCount = _gdEnemyManager.Get("_active_count").AsInt32();
|
||||
_ = activeCount;
|
||||
|
||||
_accumMs += (Time.GetTicksUsec() - t0) / 1000.0;
|
||||
_frames++;
|
||||
if (_frames >= 60)
|
||||
{
|
||||
GD.Print($"[EnemyManagerCs] 帧时间均倦: {_accumMs / _frames:F3} ms " +
|
||||
$"(active={activeCount} TODO S1: 启用 Boid 热路径)");
|
||||
_accumMs = 0; _frames = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://c8c4u4etym08g
|
||||
Reference in New Issue
Block a user