Class TractorActions
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.tractor.TractorActions
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Called when the entity is created and registered.getMode()
Returns tractor mode the tractor is currently usingboolean
isMoving()
Checks if the player/tractor is moving.boolean
isMuted()
When in the tractor inputs should be muted, this handles that.void
setMode
(TractorMode mode) Sets the mode of the tractor entity to a given modevoid
setMuted
(boolean muted) Sets the tractor's actions to be muted, This should be done when exiting the tractor.void
Stops the player from walking.void
update()
Called once per frame of the game, and should be used for most component logic.void
write
(com.badlogic.gdx.utils.Json json) Writes to the json in order to store the tractor's state, used to save the gameMethods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
TractorActions
public TractorActions()
-
-
Method Details
-
create
public void create()Description copied from class:Component
Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished. -
update
public void update()Description copied from class:Component
Called once per frame of the game, and should be used for most component logic. Not called if component is disabled. -
stopMoving
public void stopMoving()Stops the player from walking. -
isMoving
public boolean isMoving()Checks if the player/tractor is moving.- Returns:
- true if moving else false
-
isMuted
public boolean isMuted()When in the tractor inputs should be muted, this handles that.- Returns:
- if the players inputs should be muted
-
setMuted
public void setMuted(boolean muted) Sets the tractor's actions to be muted, This should be done when exiting the tractor.- Parameters:
muted
-
-
getMode
Returns tractor mode the tractor is currently using- Returns:
- the TractorMode value for the mode of the Tractor entity
-
setMode
Sets the mode of the tractor entity to a given mode- Parameters:
mode
- The TractorMode to set the mode to
-
write
public void write(com.badlogic.gdx.utils.Json json) Writes to the json in order to store the tractor's state, used to save the game
-