Class StationComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.stations.StationComponent
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Called when the entity is created and registered.com.badlogic.gdx.scenes.scene2d.ui.Label
int
getPrice()
boolean
protected void
onCollisionEnd
(com.badlogic.gdx.physics.box2d.Fixture me, com.badlogic.gdx.physics.box2d.Fixture other) Updates when the player stops colliding with the stationprotected void
onCollisionStart
(com.badlogic.gdx.physics.box2d.Fixture me, com.badlogic.gdx.physics.box2d.Fixture other) Updates when the player collides with the stationvoid
setBuyPrompt
(com.badlogic.gdx.scenes.scene2d.ui.Label prompt) Sets buy promptvoid
setConfig
(BenchConfig config) Sets the configvoid
Sets the player interacting with the benchvoid
setPlayerNear
(boolean near) Sets if the player is nearvoid
upgrade()
Triggers the upgrade from the stationMethods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, getPrio, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Field Details
-
config
-
-
Constructor Details
-
StationComponent
Initialise the station component- Parameters:
config
- config for the type of bench
-
-
Method Details
-
setPlayerNear
public void setPlayerNear(boolean near) Sets if the player is near- Parameters:
near
- is the player near
-
setConfig
Sets the config- Parameters:
config
- the config
-
setBuyPrompt
public void setBuyPrompt(com.badlogic.gdx.scenes.scene2d.ui.Label prompt) Sets buy prompt- Parameters:
prompt
- the buyPrompt
-
setPlayer
Sets the player interacting with the bench- Parameters:
player
- interacting with the bench
-
isPlayerNear
public boolean isPlayerNear()- Returns:
- is the player near
-
getPlayer
- Returns:
- the player interacting
-
getBuyPrompt
public com.badlogic.gdx.scenes.scene2d.ui.Label getBuyPrompt()- Returns:
- the buyPrompt
-
getConfig
- Returns:
- the config for the bench
-
getPrice
public int getPrice()- Returns:
- the bench price
-
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. -
onCollisionStart
protected void onCollisionStart(com.badlogic.gdx.physics.box2d.Fixture me, com.badlogic.gdx.physics.box2d.Fixture other) Updates when the player collides with the station- Parameters:
me
- the stationother
- the player colliding
-
onCollisionEnd
protected void onCollisionEnd(com.badlogic.gdx.physics.box2d.Fixture me, com.badlogic.gdx.physics.box2d.Fixture other) Updates when the player stops colliding with the station- Parameters:
me
- the stationother
- the player
-
upgrade
public void upgrade()Triggers the upgrade from the station
-