仓库组件 + 防御塔升级

- `PlayerInventoryComponent`:玩家库存组件,收集金币/组件/防御塔等道具
- 补全防御塔的升级逻辑,最高 5 级
This commit is contained in:
SepComet
2026-03-02 19:50:12 +08:00
parent 5ba94828a8
commit daba9cbdf9
20 changed files with 753 additions and 138 deletions
@@ -8,13 +8,16 @@ namespace GeometryTD.Entity.EntityData
public class DefenseTowerData : EntityDataBase
{
[SerializeField] private DefenseTowerStatsData _stats = new DefenseTowerStatsData();
[SerializeField] private int _towerLevel = 0;
public DefenseTowerData(int entityId, int typeId, Vector3 position, Quaternion rotation, DefenseTowerStatsData stats)
public DefenseTowerData(int entityId, int typeId, Vector3 position, Quaternion rotation,
DefenseTowerStatsData stats, int towerLevel = 0)
: base(entityId, typeId)
{
Position = position;
Rotation = rotation;
_stats = stats ?? new DefenseTowerStatsData();
_towerLevel = Mathf.Max(0, towerLevel);
}
public DefenseTowerStatsData Stats
@@ -22,5 +25,11 @@ namespace GeometryTD.Entity.EntityData
get => _stats;
set => _stats = value ?? new DefenseTowerStatsData();
}
public int TowerLevel
{
get => _towerLevel;
set => _towerLevel = Mathf.Max(0, value);
}
}
}