public float GetFinalStat(UpgradeStatType type, float baseStat) { float flatPermanentValue = flatPermanentUpgrades.ContainsKey(type) ? flatPermanentUpgrades[type] : 0; float percentagePermanentValue = percentagePermanentUpgrades.ContainsKey(type) ? percentagePermanentUpgrades[type] : 0; float flatTemporaryValue = flatTemporaryUpgrades.ContainsKey(type) ? flatTemporaryUpgrades[type] : 0; float percentageTemporaryValue = percentageTemporaryUpgrades.ContainsKey(type) ? percentageTemporaryUpgrades[type] : 0; return((baseStat + flatPermanentValue + flatTemporaryValue) * (1 - percentagePermanentValue / 100) * (1 - percentageTemporaryValue / 100)); }
public Blueprint_Upgrade(UpgradeStatType up_one, UpgradeStatType up_two, UpgradeStatType up_three) { upgradeOne = up_one; upgradeTwo = up_two; upgradeThree = up_three; totalUpgrades = 3; }
public Blueprint_Upgrade(UpgradeStatType up_one, UpgradeStatType up_two) { upgradeOne = up_one; upgradeTwo = up_two; totalUpgrades = 2; }
public Blueprint_Upgrade(UpgradeStatType up_one) { upgradeOne = up_one; totalUpgrades = 1; }
private IEnumerator WaitForTemporaryBoost(float lifetime, Dictionary <UpgradeStatType, float> dictionnary, UpgradeStatType type, float value) { yield return(new WaitForSeconds(lifetime)); dictionnary[type] -= value; }
public void AddPercentageTemporarytUpgrade(UpgradeStatType type, float value, float lifetime) { percentageTemporaryUpgrades[type] = percentageTemporaryUpgrades.ContainsKey(type) ? percentageTemporaryUpgrades[type] + value : value; StartCoroutine(WaitForTemporaryBoost(lifetime, percentageTemporaryUpgrades, type, value)); }
public void AddFlatTemporaryUpgrade(UpgradeStatType type, float value, float lifetime) { flatTemporaryUpgrades[type] = flatTemporaryUpgrades.ContainsKey(type) ? flatTemporaryUpgrades[type] + value : value; StartCoroutine(WaitForTemporaryBoost(lifetime, flatTemporaryUpgrades, type, value)); }
public void AddPercentagePermanentUpgrade(UpgradeStatType type, float value) { percentagePermanentUpgrades[type] = percentagePermanentUpgrades.ContainsKey(type) ? percentagePermanentUpgrades[type] + value : value; }
public void AddFlatPermanentUpgrade(UpgradeStatType type, float value) { flatPermanentUpgrades[type] = flatPermanentUpgrades.ContainsKey(type) ? flatPermanentUpgrades[type] + value : value; }