Package com.csse3200.game.components
Class CustomerSensorComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.CustomerSensorComponent
Finds the closest customer entity within a range of the player.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCustomerSensorComponent
(float sensorDistance) Create a component that senses customer entities when it collides with them. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Called when the entity is created and registered.com.badlogic.gdx.physics.box2d.Fixture
boolean
isWithinDistance
(com.badlogic.gdx.physics.box2d.Fixture fixture, float distance) void
onCollisionEnd
(com.badlogic.gdx.physics.box2d.Fixture me, com.badlogic.gdx.physics.box2d.Fixture other) void
onCollisionStart
(com.badlogic.gdx.physics.box2d.Fixture me, com.badlogic.gdx.physics.box2d.Fixture other) Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
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. -
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
-