Class CustomerSensorComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.CustomerSensorComponent

public class CustomerSensorComponent extends Component
Finds the closest customer entity within a range of the player.
  • Constructor Details

    • CustomerSensorComponent

      public CustomerSensorComponent(float sensorDistance)
      Create a component that senses customer entities when it collides with them.
      Parameters:
      sensorDistance - The range of the sensor (how far it can detect)
  • 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.
      Overrides:
      create in class Component
    • onCollisionStart

      public void onCollisionStart(com.badlogic.gdx.physics.box2d.Fixture me, com.badlogic.gdx.physics.box2d.Fixture other)
    • onCollisionEnd

      public void onCollisionEnd(com.badlogic.gdx.physics.box2d.Fixture me, com.badlogic.gdx.physics.box2d.Fixture other)
    • isWithinDistance

      public boolean isWithinDistance(com.badlogic.gdx.physics.box2d.Fixture fixture, float distance)
    • getClosestCustomer

      public com.badlogic.gdx.physics.box2d.Fixture getClosestCustomer()
    • getInteractionComponent

      public InteractionComponent getInteractionComponent()