Rev 613 |
Rev 690 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package com.gebauz.PonPonChun.game;
import com.badlogic.gdx.audio.Sound;
/** Collects in game sounds and manages them. */
public class GameSounds extends GameLogicObject
{
// Constants========================================================================================
public static final int SFX_REGULAR_CLEAR = 0;
public static final int SFX_COMBO_CLEAR = 1;
public static final int SFX_CHAIN_CLEAR = 2;
public static final int SFX_CLEAR_BREAK = 3;
public static final int SFX_FALL = 4;
public static final int SFX_SWAP = 5;
public static final int SFX_CLICK = 6;
public static final int SFX_GAMEOVER = 7;
public static final int SFX_EXPLOSION = 8;
public static final int SFX_SUCCESS = 9;
public static final int SFX_FREEZE = 10;
public static final int SFX_PICKUP_FRUIT = 11;
public static final int SFX_EAT_FRUIT = 12;
public static final int NUM_SFX = 13;
// Embedded Types===================================================================================
// Fields===========================================================================================
private Sound mSounds[] = new Sound[NUM_SFX];
// Methods==========================================================================================
public GameSounds(GameLogic gameLogic)
{
super(gameLogic);
}
public void init()
{
mSounds[SFX_REGULAR_CLEAR] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/regular_clear.wav");
mSounds[SFX_COMBO_CLEAR] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/super_clear.wav");
mSounds[SFX_CHAIN_CLEAR] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/ultra_clear.wav");
mSounds[SFX_CLEAR_BREAK] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/glass_break.wav");
mSounds[SFX_FALL] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/block_fall.wav");
mSounds[SFX_SWAP] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/swap.wav");
mSounds[SFX_CLICK] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/click.wav");
mSounds[SFX_GAMEOVER] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/game_over.wav");
mSounds[SFX_EXPLOSION] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/explosion.wav");
mSounds[SFX_SUCCESS] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/success.wav");
mSounds[SFX_FREEZE] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/freeze.wav");
mSounds[SFX_PICKUP_FRUIT] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/pickup_fruit.wav");
mSounds[SFX_EAT_FRUIT] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/eat_fruit.wav");
}
public void exit()
{
for (int i = 0; i < mSounds.length; i++)
{
getGameLogic().getGame().getAudio().removeManagedSound(mSounds[i]);
mSounds[i] = null;
}
}
public void playSound(int i)
{
if (mSounds[i] != null)
mSounds[i].play();
}
// Getters/Setters==================================================================================
}