```
feat(gameplay): 更新防御关卡金币系统 - 修改金币显示文本格式,移除冒号分隔符 - 实现差异化金币奖励机制:小怪固定1金币,英雄/Boss单位固定5金币 - 添加战术倍率支持,确保最低1金币奖励 - 增加击杀日志输出功能 - 实现英雄/Boss单位识别逻辑,通过名称和角色数据进行判断 ```
This commit is contained in:
1 parent
8c0832e7ca
commit
336ec9980d
15 files changed
+687
-3
No files matched your search
@@ -187,12 +187,16 @@ public class DefenseWaveLevelController : MonoBehaviour
|
||||
activeEnemies.RemoveAt(i);
|
||||
defeatedEnemies++;
|
||||
|
||||
// 击杀金币奖励 (基础 15 金币 * 战术增益倍率)
|
||||
// 击杀金币奖励:小怪固定 1 金币,英雄/Boss 单位固定 5 金币 (支持战术倍率)
|
||||
if (GoldManager.Instance != null)
|
||||
{
|
||||
bool isHeroUnit = IsHeroOrBossUnit(enemy);
|
||||
int baseGold = isHeroUnit ? 5 : 1;
|
||||
float killMult = BuffSelectionController.KillGoldMultiplier;
|
||||
int goldAmount = Mathf.RoundToInt(15f * killMult);
|
||||
int goldAmount = Mathf.Max(1, Mathf.RoundToInt(baseGold * killMult));
|
||||
|
||||
GoldManager.Instance.AddGold(goldAmount);
|
||||
Debug.Log($"击杀 {(isHeroUnit ? "英雄/Boss" : "小怪")},获得金币 +{goldAmount}");
|
||||
}
|
||||
|
||||
UpdateProgress(currentWaveIndex + 1, level.waves.Length);
|
||||
@@ -204,6 +208,27 @@ public class DefenseWaveLevelController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsHeroOrBossUnit(GameObject enemy)
|
||||
{
|
||||
if (enemy == null) return false;
|
||||
string n = enemy.name.ToLower();
|
||||
if (n.Contains("hero") || n.Contains("boss") || n.Contains("英雄") || n.Contains("石巨人") || n.Contains("狼人"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var unit = enemy.GetComponent<UnitBase>();
|
||||
if (unit != null && !string.IsNullOrEmpty(unit.characterDataName))
|
||||
{
|
||||
// 非小怪名称判断
|
||||
if (!unit.characterDataName.Contains("小怪") && !unit.characterDataName.Contains("蓝卫") && !unit.characterDataName.Contains("弓童") && !unit.characterDataName.Contains("蛮卒"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ApplyCharacterData(GameObject enemy, string characterId)
|
||||
{
|
||||
// 从所有 CharacterData 中按 characterId 字段查找,而不是按文件名
|
||||
|
||||
Reference in new issue
Block a user