Package com.deco2800.game.components
Class SoundComponent
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.SoundComponent
public class SoundComponent extends Component
sound component for entity, play sound by triggering event
-
Field Summary
-
Constructor Summary
Constructors Constructor Description SoundComponent(ObstacleEventHandler.ObstacleType obstacleType, Sound sound)
for test to mock SoundSoundComponent(ObstacleEventHandler.ObstacleType obstacleType, java.lang.String soundPath)
Create a component for sound play -
Method Summary
Modifier and Type Method Description void
create()
Called when the entity is created and registered.void
missileSound()
Play sound for missilevoid
roarSound()
play sound for flying monkeyvoid
spaceshipSound()
Play sound for spaceshipMethods inherited from class com.deco2800.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
SoundComponent
Create a component for sound play- Parameters:
soundPath
- file path of specific sound
-
SoundComponent
for test to mock Sound- Parameters:
sound
- test sound
-
-
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. -
spaceshipSound
public void spaceshipSound()Play sound for spaceship -
missileSound
public void missileSound()Play sound for missile -
roarSound
public void roarSound()play sound for flying monkey
-