diff options
| author | chai <215380520@qq.com> | 2023-11-02 11:51:31 +0800 |
|---|---|---|
| committer | chai <215380520@qq.com> | 2023-11-02 11:51:31 +0800 |
| commit | 7f493f682503f5186308de7b8f74b5b49233cfe4 (patch) | |
| tree | 8a91e2056bc79788ee4735dce88b8d516ba12beb /GameCode/PerkCostModifyer.cs | |
+init
Diffstat (limited to 'GameCode/PerkCostModifyer.cs')
| -rw-r--r-- | GameCode/PerkCostModifyer.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/GameCode/PerkCostModifyer.cs b/GameCode/PerkCostModifyer.cs new file mode 100644 index 0000000..d4e2d62 --- /dev/null +++ b/GameCode/PerkCostModifyer.cs @@ -0,0 +1,21 @@ +using UnityEngine; + +public class PerkCostModifyer : MonoBehaviour +{ + public Equippable requiredPerk; + + public int[] upgradeCostChange; + + private void Start() + { + if (PerkManager.IsEquipped(requiredPerk)) + { + BuildSlot component = GetComponent<BuildSlot>(); + for (int i = 0; i < component.Upgrades.Count; i++) + { + component.Upgrades[i].cost += upgradeCostChange[i]; + } + } + Object.Destroy(this); + } +} |
