- 补充游戏核心逻辑

- 完成 TodOList P0
    - 添加游戏内控制台便于调试
    - 增加敌人互斥机制提高运算负载
    - 优化互斥算法将游戏性能基准线拉到 1k 敌人
This commit is contained in:
SepComet
2026-02-20 18:08:27 +08:00
parent b4bc8b0445
commit 3742110e9a
196 changed files with 4868 additions and 31326 deletions
@@ -8,50 +8,51 @@ namespace Entity.EntityData
[Serializable]
public class EnemyData : TargetableObjectData
{
[SerializeField] private EnemyType _enemyType;
[SerializeField] private int _entityTypeId;
[SerializeField] private float _speedBase = 0;
[SerializeField] private int _dropCoin = 0;
[SerializeField] private int _dropExp = 0;
[SerializeField] private float _dropPercent = 0;
public EnemyData(int entityId, int typeId, int level) : base(
entityId, typeId, CampType.Enemy)
public EnemyData(int entityId, EnemyType enemyType, int level) : base(
entityId, (int)enemyType, CampType.Enemy)
{
DREnemy enemyRow = GameEntry.DataTable.GetDataTableRow<DREnemy>(typeId);
DREnemy enemyRow = GameEntry.DataTable.GetDataTableRow<DREnemy>((int)enemyType);
if (enemyRow == null)
{
throw new Exception($"Enemy data table row is missing, EnemyType='{enemyType}'.");
}
int effectiveLevel = Mathf.Max(1, level);
_enemyType = enemyType;
_entityTypeId = enemyRow.EntityTypeId;
MaxHealthBase = enemyRow.MaxHealth + enemyRow.HpAddPerLevel * (effectiveLevel - 1);
SpeedBase = enemyRow.Speed;
DropCoin = enemyRow.DropCoin;
DropExp = enemyRow.DropExp;
DropPercent = enemyRow.DropPercent;
_speedBase = enemyRow.Speed;
_dropCoin = enemyRow.DropCoin;
_dropExp = enemyRow.DropExp;
_dropPercent = enemyRow.DropPercent;
}
public EnemyType EnemyType => _enemyType;
public int EntityTypeId => _entityTypeId;
public override int MaxHealthBase { get; }
public float SpeedBase
{
get => _speedBase;
set => _speedBase = value;
}
public float SpeedBase => _speedBase;
public int DropCoin
{
get => _dropCoin;
set => _dropCoin = value;
}
public int DropCoin => _dropCoin;
public int DropExp
{
get => _dropExp;
set => _dropExp = value;
}
public int DropExp => _dropExp;
public float DropPercent
{
get => _dropPercent;
set => _dropPercent = value;
}
public float DropPercent => _dropPercent;
}
}
}