Class RangeAttribute<T extends java.lang.Number>
java.lang.Object
de.gurkenlabs.litiengine.attributes.Attribute<T>
de.gurkenlabs.litiengine.attributes.RangeAttribute<T>
public class RangeAttribute<T extends java.lang.Number>
extends Attribute<T>
Constructor Summary
Constructors Constructor Description RangeAttribute(T maxValue, T minValue, T baseValue)
Initializes a new instance of theRangeAttribute
class.Method Summary
Modifier and Type Method Description void
addMaxModifier(AttributeModifier<T> modifier)
void
addMinModifier(AttributeModifier<T> modifier)
protected T
applyMaxModifiers(T maxValue)
protected T
applyMinModifiers(T maxValue)
T
get()
Gets the current value of this attribute, respecting all the registeredAttributeModifier
s.T
getMax()
protected java.util.List<AttributeModifier<T>>
getMaxModifiers()
T
getMin()
protected java.util.List<AttributeModifier<T>>
getMinModifiers()
float
getRelativeCurrentValue()
void
modifyBaseValue(AttributeModifier<T> modifier)
Adjusts the base value of this attribute once with the specified modifier.void
modifyMaxBaseValue(AttributeModifier<T> modifier)
void
setMaxBaseValue(T maxValue)
void
setMinBaseValue(T minValue)
void
setToMax()
void
setToMin()
Methods inherited from class de.gurkenlabs.litiengine.attributes.Attribute
addModifier, applyModifiers, getBase, getModifiers, isModifierApplied, modifyBaseValue, removeModifier, setBaseValue, toString
Constructor Details
RangeAttribute
Initializes a new instance of theRangeAttribute
class.- Parameters:
maxValue
- The max value of this attribute.minValue
- The min value of this attributebaseValue
- The base (initial) value of this attribute
Method Details
addMinModifier
addMaxModifier
get
Description copied from class:Attribute
Gets the current value of this attribute, respecting all the registeredAttributeModifier
s.getMin
getMax
getRelativeCurrentValue
public float getRelativeCurrentValue()modifyBaseValue
Description copied from class:Attribute
Adjusts the base value of this attribute once with the specified modifier.- Overrides:
modifyBaseValue
in classAttribute<T extends java.lang.Number>
- Parameters:
modifier
- The modifier used to adjust this attribute's base value.- See Also:
Attribute.getBase()
,Attribute.setBaseValue(Number)
modifyMaxBaseValue
setToMin
public void setToMin()setToMax
public void setToMax()setMaxBaseValue
setMinBaseValue
getMinModifiers
getMaxModifiers
applyMinModifiers
applyMaxModifiers