public abstract class Human extends GameObject implements com.badlogic.gdx.utils.Pool.Poolable
Modifier and Type | Class and Description |
---|---|
static class |
Human.Direction |
static class |
Human.Mode |
static class |
Human.State |
Constructor and Description |
---|
Human(float x,
float y,
float width,
float height)
Creates a Human GameObject instance whose bottom-center is at (x,y) and whose Rectangle collider is initialized with the given width and height.
|
Modifier and Type | Method and Description |
---|---|
Human.Direction |
getDirection()
Gets the direction (LEFT or RIGHT) that the GameObject is facing.
|
float |
getHealth()
Gets the human's health.
|
float |
getInvulnerabilityTime()
Gets the amount of time that the Human is invulnerable for.
|
Human.Mode |
getMode()
Gets the mode (EXPLORING or FIGHTING) of the GameObject
|
Human.State |
getPreviousState()
Retrieves the previous state of the Human.
|
Human.State |
getState()
Gets the state (IDLE, JUMP, etc.) of the GameObject, used to dictate which animations to use.
|
GameObject |
getTarget()
Gets the target where the human wants to walk to.
|
float |
getWalkSpeed()
Gets the human's walking speed in the x-direction.
|
boolean |
isDead()
Returns true if the Human's health has dropped to zero or below.
|
boolean |
isFacing(Human other)
Returns true if the given human is facing the other human, and this human can thus see the other one.
|
boolean |
isInvulnerable()
Returns true if the Human is invulnerable to incoming attacks.
|
boolean |
isTargetReached()
Returns true if the human has reached his target.
|
void |
loseTarget()
Lose the human's current target so that he stops walking towards his target.
|
abstract void |
makeInvulnerable()
Makes the Human invulnerable for a given amount of seconds.
|
void |
reset()
Called whenever this box GameObject has been pushed back into a pool.
|
void |
setDirection(Human.Direction direction)
Sets the direction (LEFT or RIGHT) that the GameObject is facing.
|
void |
setHealth(float health)
Sets the human's health.
|
void |
setInvulnerabilityTime(float invulnerabilityTime)
Sets the amount of time that the Human is invulnerable for.
|
void |
setMode(Human.Mode mode)
Sets the mode (EXPLORING or FIGHTING) of the GameObject
|
void |
setPreviousState(Human.State previousState)
Sets the previous state of the Human.
|
void |
setState(Human.State state)
Sets the state (IDLE, JUMP, etc.) of the GameObject, used to dictate which animations to use.
|
void |
setTarget(GameObject target)
Sets the target where the human wants to walk to.
|
void |
setTargetReached(boolean targetReached)
Sets whether or not the human has reached his target.
|
void |
setWalkSpeed(float walkSpeed)
Sets the human's walking speed in the x-direction in meters/second.
|
void |
takeDamage(float damage)
Deals damage to the human by removing the given amount from its health.
|
void |
update(float deltaTime)
Updates the Human's game logic, such as his state time.
|
canTarget, getAcceleration, getCollider, getObjectId, getPosition, getPreviousPosition, getSkeleton, getStateTime, getTerrainCell, getVelocity, getX, getY, isAbove, moveTo, setAcceleration, setCollider, setObjectId, setPosition, setSkeleton, setStateTime, setTerrainCell, setVelocity, setVelocityX, setVelocityY, setX, setY, updateCollider, updatePosition
public Human(float x, float y, float width, float height)
public void update(float deltaTime)
update
in class GameObject
public void loseTarget()
public boolean isFacing(Human other)
public Human.Mode getMode()
public void setMode(Human.Mode mode)
public Human.State getState()
public void setState(Human.State state)
public Human.State getPreviousState()
public void setPreviousState(Human.State previousState)
public Human.Direction getDirection()
public void setDirection(Human.Direction direction)
public void setTarget(GameObject target)
public GameObject getTarget()
public boolean isTargetReached()
public void setTargetReached(boolean targetReached)
public float getWalkSpeed()
public void setWalkSpeed(float walkSpeed)
public void takeDamage(float damage)
public abstract void makeInvulnerable()
public boolean isInvulnerable()
public float getInvulnerabilityTime()
public void setInvulnerabilityTime(float invulnerabilityTime)
public float getHealth()
public void setHealth(float health)
public boolean isDead()
public void reset()
reset
in interface com.badlogic.gdx.utils.Pool.Poolable