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 TypeMethodDescriptionvoid
create()
Initializes the StunComponent and sets up event listeners for stun-related events.boolean
Checks whether the entity is currently stunned.void
setStun
(boolean stunned) Sets the stun status of the entity.void
setStunDuration
(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
-true
if the entity should be stunned;false
to 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:
true
if the entity is stunned;false
if not stunned.
-