补充参战防御塔进入战斗逻辑
- 将 Inventory 中参战的防御塔数据传递到 CombatSelectForm 中 - 为防御塔的图标展示添加 TowerRepoItem 与 TowerIconArea 适配防御塔的三层 Image
This commit is contained in:
@@ -40,7 +40,7 @@ namespace GeometryTD.Map
|
||||
}
|
||||
|
||||
public bool TryBuildTower(Vector3Int foundationCell, Func<Vector3Int, bool> isFoundationCell, int buildIndex,
|
||||
int[] buildTowerCosts, int towerTypeId, Tilemap tilemap, Func<int, bool> tryConsumeCoin,
|
||||
int[] buildTowerCosts, TowerStatsData buildTowerStats, Color muzzleColor, Color bearingColor, Color baseColor, int towerTypeId, Tilemap tilemap, Func<int, bool> tryConsumeCoin,
|
||||
Action<int> addCoin,
|
||||
out int towerEntityId)
|
||||
{
|
||||
@@ -55,14 +55,19 @@ namespace GeometryTD.Map
|
||||
return false;
|
||||
}
|
||||
|
||||
TowerStatsData towerStats = CloneTowerStats(buildTowerStats);
|
||||
if (towerStats == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int buildCost = GetBuildTowerCost(buildTowerCosts, buildIndex);
|
||||
if (tryConsumeCoin != null && !tryConsumeCoin(buildCost))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TowerStatsData towerStats = BuildTowerStats(buildIndex);
|
||||
if (!TryShowTowerEntity(foundationCell, towerStats, towerTypeId, tilemap, out int newTowerEntityId))
|
||||
if (!TryShowTowerEntity(foundationCell, towerStats, muzzleColor, bearingColor, baseColor, towerTypeId, tilemap, out int newTowerEntityId))
|
||||
{
|
||||
addCoin?.Invoke(buildCost);
|
||||
return false;
|
||||
@@ -177,7 +182,7 @@ namespace GeometryTD.Map
|
||||
return Mathf.Max(0, buildTowerCosts[buildIndex]);
|
||||
}
|
||||
|
||||
private static bool TryShowTowerEntity(Vector3Int foundationCell, TowerStatsData towerStats,
|
||||
private static bool TryShowTowerEntity(Vector3Int foundationCell, TowerStatsData towerStats, Color muzzleColor, Color bearingColor, Color baseColor,
|
||||
int towerTypeId,
|
||||
Tilemap tilemap, out int towerEntityId)
|
||||
{
|
||||
@@ -192,7 +197,7 @@ namespace GeometryTD.Map
|
||||
Vector3 towerPosition = tilemap != null ? tilemap.GetCellCenterWorld(foundationCell) : foundationCell;
|
||||
towerPosition.z = 0f;
|
||||
var towerData = new TowerData(entityId, typeId, towerPosition, Quaternion.identity, towerStats,
|
||||
MinTowerLevel);
|
||||
MinTowerLevel, muzzleColor, bearingColor, baseColor);
|
||||
GameEntry.Entity.ShowDefenseTower(towerData);
|
||||
|
||||
towerEntityId = entityId;
|
||||
@@ -346,4 +351,4 @@ namespace GeometryTD.Map
|
||||
return values != null ? values.Length : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user