Package com.csse3200.game.components
Class SoundComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.SoundComponent
Sound handler for entities. Provides a component to register sounds with an event.
Once these events are registered, the associated sound will play every time the event is triggered.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
registerSound
(String event, String sound) Registers the sound to play when the given event is triggered.Methods inherited from class com.csse3200.game.components.Component
create, dispose, earlyUpdate, getEntity, getPrio, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
SoundComponent
public SoundComponent()
-
-
Method Details
-
registerSound
Registers the sound to play when the given event is triggered. Returns true if successful and false if not.- Parameters:
event
- the name of the eventsound
- the path of the sound file to play- Returns:
- whether the sound was successfully registered
- Requires:
- sound has already been registered with the resourceService
-