Kiwi.HUD.HUDComponents.Counter Class
The Counter component handles a incrementation/decrementation of a singular numeric value. You can also specifiy maximum/minimum values that the numeric value has be within but by default there is no max/min.
Constructor
Kiwi.HUD.HUDComponents.Counter
-
owner
-
current
-
[max=null]
-
[min=null]
Parameters:
-
owner
AnyThe object that this Component belongs to.
-
current
NumberThe current value.
-
[max=null]
Number optionalThe maximum value it can be. Default is null which means no maximum.
-
[min=null]
Number optionalThe minimum value that the current can be. Default is null which means no minium.
Returns:
Item Index
Methods
currentPercent
()
Number
public
Returns:
decrease
-
[val=1]
Decreases the current value by the amount past. If the new amount would be less than the minimun it goes to the min instead.
Parameters:
-
[val=1]
Number optionalThe amount that you want to decrease the current value by. Default is 1.
Returns:
destroy
()
public
Destroys this component and all of the properties that exist on it.
increase
-
[val=1]
Increases the current value by the amount past. If the new amount would be greater than the maximum it goes to the max instead.
Parameters:
-
[val=1]
Number optionalThe amount that you want to increase the current value by. Default is 1.
Returns:
objType
()
String
public
The type of object that this is.
Returns:
'CounterComponent'
postUpdate
()
public
Components can postUpdate, that is run an update after the parent has updated. This is to be overriden by subclasses.
preUpdate
()
public
Components can preUpdate, that is update before the parent updates. This is to be overriden by subclasses.
update
()
public
If the component is being added to a State rather than a Game Object then over-ride its update method to perform required tasks.
Properties
_current
Number
private
The current value of the range.
_max
Number
private
The maximum value that of the range.
_min
Number
private
The minimum value that of the range.
Default: 0
active
Boolean
public
An active Component is one that has its update method called by its parent.
Default: true
current
Number
public
Set allows setting of the current value that the range can be in. The current value will only change if it is within the maximum/minimum values. Get returns the current value.
dirty
Boolean
deprecated
public
The state of this component.
Default: false
max
Number
public
Set allows setting of the maximum value that the range can be in. Get returns the maximum value.
min
Number
public
Set allows setting of the minimum value that the range can be in. Get returns the minimum value.
name
String
public
The name of this component.
owner
Object
public
The object that owns this entity