Пример #1
0
        public void UpdateNutrientHealthBoost()
        {
            float fruitRel     = FruitLevel / MaxSaturation;
            float grainRel     = GrainLevel / MaxSaturation;
            float vegetableRel = VegetableLevel / MaxSaturation;
            float proteinRel   = ProteinLevel / MaxSaturation;

            EntityBehaviorHealth bh = entity.GetBehavior <EntityBehaviorHealth>();
            //float baseMax = bh.MaxHealth;

            /*float MaxHealthNow =
             *  fruitRel * 0.25f * baseMax +
             *  grainRel * 0.25f * baseMax +
             *  vegetableRel * 0.25f * baseMax +
             *  proteinRel * 0.25f * baseMax
             * ;*/

            // 0 nutr: 15 hp
            // 4 nutr: 25 hp

            // y = k*x + d
            // k = (y2-y1) / (x2-x1)

            // k = (25 - 15) / (4 - 0)
            // k = 10/4 = 2.5

            // 25 = 2.5 * 4 + d
            // d = 10

            float healthGain = 2.5f * (fruitRel + grainRel + vegetableRel + proteinRel);

            bh.MaxHealthModifiers["nutrientHealthMod"] = healthGain;
            bh.MarkDirty();
        }
Пример #2
0
        public void UpdateNutrientHealthBoost()
        {
            float fruitRel     = FruitLevel / MaxSaturation;
            float grainRel     = GrainLevel / MaxSaturation;
            float vegetableRel = VegetableLevel / MaxSaturation;
            float proteinRel   = ProteinLevel / MaxSaturation;

            EntityBehaviorHealth bh = entity.GetBehavior <EntityBehaviorHealth>();

            float healthGain = 2.5f * (fruitRel + grainRel + vegetableRel + proteinRel);

            bh.MaxHealthModifiers["nutrientHealthMod"] = healthGain;
            bh.MarkDirty();
        }