Package com.prineside.tdi2.systems
Class SoundSystem
java.lang.Object
com.prineside.tdi2.Registrable
com.prineside.tdi2.GameSystem
com.prineside.tdi2.systems.SoundSystem
- All Implemented Interfaces:
Disposable,KryoSerializable
-
Field Summary
Fields inherited from class com.prineside.tdi2.Registrable
S -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoiddraw(float realDeltaTime) voidplayExplosionSound(float posX) voidplayShotSound(StaticSoundType soundType, Tower tower) voidplayStatic(StaticSoundType soundType) voidplayStaticParameterized(StaticSoundType soundType, float volume, float pitch, float pan) voidPerforms the final configuration of the system.booleanShould the update() method be rendered on the debug overlayvoidsetMusicPlaybackHandler(Runnable handler) Allows to override music playback handling (changing volume / stopping or starting the music etc) If handler is null, the default handler will be used.voidsetup()Performs the initial configuration of the system.voidCalled when: - Game paused or resumed - Sound system set up and post set up - Volume adjusted in pause - Music list overlay is shown / hidden during the game - Probably some other places in future This method can be overridden by a custom handler, see setMusicPlaybackHandler().Methods inherited from class com.prineside.tdi2.GameSystem
dispose, getFastStateHash, postStateRestore, updateMethods inherited from class com.prineside.tdi2.Registrable
isRegistered, read, setRegistered, setUnregistered, write
-
Constructor Details
-
SoundSystem
public SoundSystem()
-
-
Method Details
-
profileUpdate
public boolean profileUpdate()Description copied from class:GameSystemShould the update() method be rendered on the debug overlay- Overrides:
profileUpdatein classGameSystem
-
getSystemName
- Specified by:
getSystemNamein classGameSystem
-
affectsGameState
public boolean affectsGameState()- Specified by:
affectsGameStatein classGameSystem
-
setup
public void setup()Description copied from class:GameSystemPerforms the initial configuration of the system. At the moment of call, systemProvider already contains all objects of systems.- Overrides:
setupin classGameSystem
-
postSetup
public void postSetup()Description copied from class:GameSystemPerforms the final configuration of the system. At the moment of call, all systems are already loaded and setup(), all listeners are already added.- Overrides:
postSetupin classGameSystem
-
setMusicPlaybackHandler
Allows to override music playback handling (changing volume / stopping or starting the music etc) If handler is null, the default handler will be used. It is suggested to account for at least these conditions: - If SettingsManager.isMusicEnabled() is false, do not play any music (call MusicManager.stopMusic()) - If in pause and music list is not visible (S.gameState.isPaused() && !MusicListOverlay.i().isVisible()), reduce the volume (MusicManager.setVolume(0.25, 2, false)) -
updateMusicPlayback
public void updateMusicPlayback()Called when: - Game paused or resumed - Sound system set up and post set up - Volume adjusted in pause - Music list overlay is shown / hidden during the game - Probably some other places in future This method can be overridden by a custom handler, see setMusicPlaybackHandler(). Default logic: - If wave is not started yet or music is disabled in settings (volume == 0), stops any music playing and returns - If map music is ignored, starts or continues to play menu music. If not, searches for a music tile and plays it - Sets to full volume if not paused or if music list overlay is visible. Sets to 25% volume otherwise (in pause and list is not visible) -
draw
public void draw(float realDeltaTime) -
playShotSound
-
playStatic
-
playExplosionSound
public void playExplosionSound(float posX) -
playStaticParameterized
public void playStaticParameterized(StaticSoundType soundType, float volume, float pitch, float pan)
-