diff options
Diffstat (limited to 'Thronefall_1_57/Decompile/Thronefall/PerkIncomeModifyer.cs')
| -rw-r--r-- | Thronefall_1_57/Decompile/Thronefall/PerkIncomeModifyer.cs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Thronefall_1_57/Decompile/Thronefall/PerkIncomeModifyer.cs b/Thronefall_1_57/Decompile/Thronefall/PerkIncomeModifyer.cs new file mode 100644 index 0000000..cbdb207 --- /dev/null +++ b/Thronefall_1_57/Decompile/Thronefall/PerkIncomeModifyer.cs @@ -0,0 +1,54 @@ +using UnityEngine; + +public class PerkIncomeModifyer : MonoBehaviour, ISaveLoad +{ + public Equippable requiredPerk; + + [BalancingParameter(BalancingParameter.EType.Default)] + public int[] upgradeIncomeChange; + + private bool executed; + + public void OnBeforeMainLoadPass(string guid) + { + Execute(); + } + + public void OnAfterMainLoadPass(string guid) + { + } + + public void OnLoad(string guid) + { + } + + public void OnSave(string guid) + { + } + + private void Start() + { + Execute(); + } + + private void Execute() + { + if (executed) + { + return; + } + executed = true; + if (PerkManager.IsEquipped(requiredPerk)) + { + BuildSlot component = GetComponent<BuildSlot>(); + for (int i = 0; i < component.Upgrades.Count; i++) + { + foreach (BuildSlot.UpgradeBranch upgradeBranch in component.Upgrades[i].upgradeBranches) + { + upgradeBranch.goldIncomeChange += upgradeIncomeChange[i]; + } + } + } + Object.Destroy(this); + } +} |
