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 TypeMethodDescriptionboolean
void
draw
(float realDeltaTime) void
playExplosionSound
(float posX) void
playShotSound
(StaticSoundType soundType, Tower tower) void
playStatic
(StaticSoundType soundType) void
playStaticParameterized
(StaticSoundType soundType, float volume, float pitch, float pan) void
Performs the final configuration of the system.boolean
Should the update() method be rendered on the debug overlayvoid
setMusicPlaybackHandler
(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.void
setup()
Performs the initial configuration of the system.void
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().Methods inherited from class com.prineside.tdi2.GameSystem
dispose, getFastStateHash, postStateRestore, update
Methods 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:GameSystem
Should the update() method be rendered on the debug overlay- Overrides:
profileUpdate
in classGameSystem
-
getSystemName
- Specified by:
getSystemName
in classGameSystem
-
affectsGameState
public boolean affectsGameState()- Specified by:
affectsGameState
in classGameSystem
-
setup
public void setup()Description copied from class:GameSystem
Performs the initial configuration of the system. At the moment of call, systemProvider already contains all objects of systems.- Overrides:
setup
in classGameSystem
-
postSetup
public void postSetup()Description copied from class:GameSystem
Performs the final configuration of the system. At the moment of call, all systems are already loaded and setup(), all listeners are already added.- Overrides:
postSetup
in 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)
-