コード例 #1
0
ファイル: PartEntryCostHolder.cs プロジェクト: ts826848/RP-0
        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);
        }
コード例 #2
0
ファイル: EntryCostModifier.cs プロジェクト: jhathawaytn/RP-0
        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));
        }
コード例 #3
0
ファイル: EntryCostModifier.cs プロジェクト: jhathawaytn/RP-0
        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));
        }