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 TypeMethodDescriptionvoidcreate()Called when the entity is created and registered.getMode()Returns tractor mode the tractor is currently usingbooleanisMoving()Checks if the player/tractor is moving.booleanisMuted()When in the tractor inputs should be muted, this handles that.voidsetMode(TractorMode mode) Sets the mode of the tractor entity to a given modevoidsetMuted(boolean muted) Sets the tractor's actions to be muted, This should be done when exiting the tractor.voidStops the player from walking.voidupdate()Called once per frame of the game, and should be used for most component logic.voidwrite(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:ComponentCalled 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:ComponentCalled 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
-