Rev 709 |
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 SFX_FREEZE_TIME = 13;
public static final int SFX_SUPERPOWER_ACTIVATE = 14;
public static final int SFX_BLEEP_A = 15;
public static final int SFX_BLEEP_B = 16;
public static final int SFX_BLEEP_C = 17;
public static final int NUM_SFX = 18;
// 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");
mSounds[SFX_FREEZE_TIME] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/freeze_time.wav");
mSounds[SFX_SUPERPOWER_ACTIVATE] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/superpower_activate.wav");
mSounds[SFX_BLEEP_A] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/bleep_a.wav");
mSounds[SFX_BLEEP_B] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/bleep_b.wav");
mSounds[SFX_BLEEP_C] = getGameLogic().getGame().getAudio().newManagedSound("data/sounds/bleep_c.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();
}
}
public void stopSound(int i)
{
if (mSounds[i] != null)
{
mSounds[i].stop();
}
}
// Getters/Setters==================================================================================
}