protected double ModCost(double cost, double subtractMultipler = 1.0d) { double subtract = 0d; foreach (KeyValuePair <string, double> kvp in entryCostSubtractors) { if (EntryCostModifier.IsUnlocked(kvp.Key)) { subtract += kvp.Value * subtractMultipler; } } subtract = Math.Min(maxSubtraction, subtract); cost -= subtract; foreach (KeyValuePair <string, double> kvp in entryCostMultipliers) { if (EntryCostModifier.IsUnlocked(kvp.Key)) { cost *= kvp.Value; } } if (cost > 0d) { return(cost); } return(0d); }
public override void OnAwake() { base.OnAwake(); if (_instance != null) { Object.Destroy(this); return; } _instance = this; partlist = new Dictionary <string, PartEntryCostHolder>(); FillPartList(); GameEvents.OnPartPurchased.Add(new EventData <AvailablePart> .OnEvent(onPartPurchased)); }
public override void OnAwake() { base.OnAwake(); if (_instance != null) { Object.Destroy(this); return; } _instance = this; partlist = new Dictionary<string, PartEntryCostHolder>(); FillPartList(); GameEvents.OnPartPurchased.Add(new EventData<AvailablePart>.OnEvent(onPartPurchased)); }