* Add parameters for negative sound in nitro challenge

* Fix #3197
This commit is contained in:
Alayan-stk-2
2018-05-06 02:33:12 +02:00
committed by auriamg
parent f44fbbfdfb
commit 267dfde46f
2 changed files with 22 additions and 1 deletions

View File

@@ -74,6 +74,9 @@ LocalPlayerController::LocalPlayerController(AbstractKart *kart,
m_ugh_sound = SFXManager::get()->getBuffer("ugh");
m_grab_sound = SFXManager::get()->getBuffer("grab_collectable");
m_full_sound = SFXManager::get()->getBuffer("energy_bar_full");
m_unfull_sound = SFXManager::get()->getBuffer("energy_bar_unfull");
m_is_above_nitro_target = false;
// Attach Particle System
Track *track = Track::getCurrentTrack();
@@ -235,6 +238,10 @@ void LocalPlayerController::update(int ticks)
}
}
}
if (m_is_above_nitro_target == true &&
m_kart->getEnergy() < race_manager->getCoinTarget())
nitroNotFullSound();
#endif
if (m_kart->getKartAnimation() && m_sound_schedule == false)
{
@@ -347,9 +354,10 @@ void LocalPlayerController::collectedItem(const Item &item, int add_info,
}
else if (race_manager->getCoinTarget() > 0 &&
old_energy < race_manager->getCoinTarget() &&
m_kart->getEnergy() == race_manager->getCoinTarget())
m_kart->getEnergy() >= race_manager->getCoinTarget())
{
m_kart->playSound(m_full_sound);
m_is_above_nitro_target = true;
}
else
{
@@ -373,6 +381,15 @@ void LocalPlayerController::collectedItem(const Item &item, int add_info,
}
} // collectedItem
//-----------------------------------------------------------------------------
/** If the nitro level has gone under the nitro goal, play a bad effect sound
*/
void LocalPlayerController::nitroNotFullSound()
{
m_kart->playSound(m_unfull_sound);
m_is_above_nitro_target = false;
} //nitroNotFullSound
// ----------------------------------------------------------------------------
/** Returns true if the player of this controller can collect achievements.
* At the moment only the current player can collect them.

View File

@@ -55,9 +55,13 @@ private:
SFXBuffer *m_ugh_sound;
SFXBuffer *m_grab_sound;
SFXBuffer *m_full_sound;
SFXBuffer *m_unfull_sound;
bool m_is_above_nitro_target;
virtual void steer(int, int) OVERRIDE;
virtual void displayPenaltyWarning() OVERRIDE;
void nitroNotFullSound();
public:
LocalPlayerController(AbstractKart *kart,
const int local_player_id,