Class SoundComponent

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

public class SoundComponent extends Component
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.
  • Constructor Details

    • SoundComponent

      public SoundComponent()
  • Method Details

    • registerSound

      public boolean registerSound(String event, String sound)
      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 event
      sound - the path of the sound file to play
      Returns:
      whether the sound was successfully registered
      Requires:
      sound has already been registered with the resourceService