重构清理敌人类
This commit is contained in:
+5
-9
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user