-
Notifications
You must be signed in to change notification settings - Fork 7
Plant sound proximity component
abhat0 edited this page Oct 17, 2023
·
2 revisions
The sound proximity component only allows plants to play sounds when the player is close enough. This will prevent the game from being cluttered with noise from plants.
-
private final float radius
: Radius of the hitbox area -
private final circleShape shape
: shape of the hitbox
-
public void create()
: Sets up the radius for the collider and listen for relevant services. -
private void onCollisionStart
: Check if the entity is a player and tell the plant the player is in range. -
private void onCollisionEnd
: Check if the entity leaving is the player and tell the plant the player is not in range.
To incorporate the PlantProximityComponent into the plant system:
1. Import the necessary classes
import com.csse3200.game.components.plants.PlantProximityComponent;
2. Add the PlantProximityComponent to a plant entity
plant.addComponent(new PlantProximityComponent());
- create the setUp method to be run before each test
- initialize the
PlantProximityComponent
object - mock the necessary dependencies
- create tests for all methods