Ejemplo n.º 1
0
        public float GetMax()
        {
            float         level         = 0f;
            MinMaxFloatAT minMaxFloatAT = attributeType as MinMaxFloatAT;

            if (minMaxFloatAT != null)
            {
                level = minMaxFloatAT.GetMax(entity);
                if (entity.inventoryType.usesItemAttributeTypeModifiers)
                {
                    level = entity.inventoryType.GetAlwaysItemAttributeTypeModifiers(entity, attributeType, level, ItemAttributeTypeModifier.ChangeType.Max);
                }
            }
            return(level);
        }
Ejemplo n.º 2
0
        public void ChangeLevelUsingChangeCurve(Entity entity, float curveInput, MinMaxFloatAT otherAT, float multiplier, bool increaseLevel)
        {
            ChangeCurve changeCurve = FindChangeCurve(otherAT);

            if (changeCurve == null)
            {
                Debug.LogError(entity.name + ": Trying to change an Attribute (" + name + ") Level with " + otherAT.name +
                               " but it does not exist in the Change Curves Mappings.  Please Fix.");
                return;
            }

            float rate         = changeCurve.changeMinMaxCurve.NormAndEval(curveInput, otherAT.GetMin(entity), otherAT.GetMax(entity));
            float changeAmount = multiplier * rate;

            if (!increaseLevel)
            {
                changeAmount = -changeAmount;
            }

            SetData(entity, new MinMaxFloatData()
            {
                floatValue = changeAmount + entitiesData[entity].floatValue
            });

            //Debug.Log(entity.name + ": Burned " + changeAmount + " Energy from " + rate + " burn rate for " + multiplier);
        }