重构清理敌人类

This commit is contained in:
2026-09-15 11:07:01 +08:00
parent 421f8bf619
commit 88ed35e757
34 changed files with 568 additions and 457 deletions
@@ -9,11 +9,9 @@ namespace SepCore.Simulation
// Bridges entity show/hide events into simulation state registration.
public sealed class EntitySync
{
private const string EnemyGroupName = "Enemy";
private const string DropGroupName = "Drop";
private const string BulletGroupName = "Bullet";
private const string ProjectileGroupName = "Projectile";
private const string EnemyProjectileGroupName = "EnemyProjectile";
private static string EnemyGroupName => GameEntry.Luban.Global.EnemyGroupName;
private static string DropGroupName => GameEntry.Luban.Global.DropGroupName;
private static string ProjectileGroupName => GameEntry.Luban.Global.ProjectileGroupName;
private readonly SimulationWorld _world;
private bool _isEventSubscribed;
@@ -74,8 +72,7 @@ namespace SepCore.Simulation
return;
}
if ((groupName == BulletGroupName || groupName == ProjectileGroupName ||
groupName == EnemyProjectileGroupName) &&
if (groupName == ProjectileGroupName &&
args.Entity.Logic is EntityBase projectileEntity)
{
_world.RegisterProjectileLifecycle(projectileEntity, args.UserData);
@@ -101,8 +98,7 @@ namespace SepCore.Simulation
return;
}
if (groupName == BulletGroupName || groupName == ProjectileGroupName ||
groupName == EnemyProjectileGroupName)
if (groupName == ProjectileGroupName)
{
_world.UnregisterProjectileLifecycle(args.EntityId);
}