Class StunComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.combat.StunComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
A component that manages the stun status of an entity in a game.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate()Initializes the StunComponent and sets up event listeners for stun-related events.booleanChecks whether the entity is currently stunned.voidsetStun(boolean stunned) Sets the stun status of the entity.voidsetStunDuration(float duration) Sets the stun duration for the entity.Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update, write
-
Constructor Details
-
StunComponent
public StunComponent()
-
-
Method Details
-
create
public void create()Initializes the StunComponent and sets up event listeners for stun-related events. -
setStun
public void setStun(boolean stunned) Sets the stun status of the entity.- Parameters:
stunned-trueif the entity should be stunned;falseto remove stun.
-
setStunDuration
public void setStunDuration(float duration) Sets the stun duration for the entity.- Parameters:
duration- The duration (in seconds) for which the entity should be stunned.
-
isStunned
public boolean isStunned()Checks whether the entity is currently stunned.- Returns:
trueif the entity is stunned;falseif not stunned.
-