Bandidos
|
Public Member Functions | |
HealthComponent (float health) | |
float | getNormalizedHealth () |
float | damage (float amount) |
float | heal (float amount) |
void | kill () |
boolean | isAlive () |
float | getHealth () |
float | getMaxHealth () |
void | awake () |
Public Member Functions inherited from com.mygdx.game.engine.entities.components.BaseEntityComponent | |
EngineTween | startTweenOnComponent (Tween tween, TweenStartType tweenStartType) |
Timeline | startTimelineOnComponent (Timeline timeline, boolean updateInGameTime) |
EngineTween | doFloat (TweenableFloat floatToTween, float newValue, float duration, TweenStartType tweenStartType) |
void | stopAllComponentTweens () |
void | initialize (BaseEntity parentEntity) |
BaseEntity | getParentOfComponent () |
boolean | isActive () |
boolean | isDestroyed () |
void | setActiveState (boolean activeState) |
void | destroy () |
void | update (float deltaTime) |
abstract void | awake () |
Public Member Functions inherited from com.mygdx.game.engine.events.EventDispatcher | |
void | addEventListener (String type, IEventReceiver listeningClass) |
void | dispatchEvent (Event event) |
void | removeEventListener (String type, IEventReceiver listener) |
boolean | hasEventListener (String type) |
ArrayList< ListenerItem > | getAllListeners () |
void | destroyAllListeners () |
void | clean () |
Static Public Attributes | |
static final String | EVENT_HEALTH_HEALED = "EventHealthHealed" |
static final String | EVENT_HEALTH_DAMAGED = "EventHealthDamaged" |
static final String | EVENT_HEALTH_DIED = "EventHealthDied" |
Protected Member Functions | |
void | updated (float deltaTime) |
void | destroyed () |
void | activeStateChanged () |
Protected Member Functions inherited from com.mygdx.game.engine.entities.components.BaseEntityComponent | |
abstract void | updated (float deltaTime) |
abstract void | destroyed () |
abstract void | activeStateChanged () |
This component holds all the info for health. It can be damaged and healed. It also dispatches events on these occasions
com.mygdx.game.components.HealthComponent.HealthComponent | ( | float | health | ) |
This will set the maximum health and current health for the component.
health |
|
protected |
void com.mygdx.game.components.HealthComponent.awake | ( | ) |
float com.mygdx.game.components.HealthComponent.damage | ( | float | amount | ) |
Damages the component, affecting the health amount in a negative way. This will also trigger the EVENT_HEALTH_DAMAHED and, when the component has no health left, EVENT_HEALTH_DIED The component can not be damaged when it is already dead.
amount | to take off of the health |
|
protected |
float com.mygdx.game.components.HealthComponent.getHealth | ( | ) |
Returns the current health value of the component
float com.mygdx.game.components.HealthComponent.getMaxHealth | ( | ) |
Returns the maximum health this component can have
float com.mygdx.game.components.HealthComponent.getNormalizedHealth | ( | ) |
Returns the normalized value of the current health in relation to the MaxHealth
float com.mygdx.game.components.HealthComponent.heal | ( | float | amount | ) |
Heals the component, affecting the health amount in a positive way. This will also trigger the EVENT_HEALTH_HEALED. The component can not be healed when it is dead or when it has full health.
amount | to add to the current health |
boolean com.mygdx.game.components.HealthComponent.isAlive | ( | ) |
Returns whether the component still has health left.
void com.mygdx.game.components.HealthComponent.kill | ( | ) |
Calls the Damage() method with enough damage to kill the component.
|
protected |
|
static |
This event type is fired by the HealthComponent when it is damaged
|
static |
This event type is fired by the HealthComponent when it is killed
|
static |
This event type is fired by the HealthComponent when it is healed