Class StationComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.stations.StationComponent

public class StationComponent extends Component
  • Field Details

  • Constructor Details

    • StationComponent

      public StationComponent(BenchConfig config)
      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

      public void setConfig(BenchConfig config)
      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

      public void setPlayer(Entity player)
      Sets the player interacting with the bench
      Parameters:
      player - interacting with the bench
    • isPlayerNear

      public boolean isPlayerNear()
      Returns:
      is the player near
    • getPlayer

      public Entity getPlayer()
      Returns:
      the player interacting
    • getBuyPrompt

      public com.badlogic.gdx.scenes.scene2d.ui.Label getBuyPrompt()
      Returns:
      the buyPrompt
    • getConfig

      public BenchConfig 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.
      Overrides:
      create in class Component
    • 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 station
      other - 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 station
      other - the player
    • upgrade

      public void upgrade()
      Triggers the upgrade from the station