本文整理汇总了C++中sgd::AudioManager::StopAudio方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioManager::StopAudio方法的具体用法?C++ AudioManager::StopAudio怎么用?C++ AudioManager::StopAudio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sgd::AudioManager
的用法示例。
在下文中一共展示了AudioManager::StopAudio方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckDamage
void Player::CheckDamage(void)
{
SGD::AudioManager* pAudio = SGD::AudioManager::GetInstance();
Game* pGame = Game::GetInstance();
// dead, !hurt
if (profile.health <= 0.0f)
{
profile.health = 0.0f;
if (m_hHurt != nullptr && pAudio->IsAudioPlaying(*m_hHurt) == true)
pAudio->StopAudio(*m_hHurt);
if (pAudio->IsAudioPlaying(*m_hDeath) == false)
voice = pAudio->PlayAudio(*m_hDeath, false);
pAudio->SetVoiceVolume(voice);
m_bIsAlive = false;
SetVelocity({ 0, 0 });
}
// hurt, !dead
else
{
int sound = rand() % 3;
switch (sound)
{
case 0:
m_hHurt = &pGame->playerHurt1;
break;
case 1:
m_hHurt = &pGame->playerHurt2;
break;
case 2:
m_hHurt = &pGame->playerHurt3;
break;
default:
break;
}
if (pAudio->IsAudioPlaying(pGame->playerHurt1) == false &&
pAudio->IsAudioPlaying(pGame->playerHurt2) == false &&
pAudio->IsAudioPlaying(pGame->playerHurt3) == false)
voice = pAudio->PlayAudio(*m_hHurt, false);
pAudio->SetVoiceVolume(voice);
m_hHurt = nullptr;
}
}
示例2:
// Input
/*virtual*/ bool IntroState::Input(void)
{
SGD::InputManager* pInput = SGD::InputManager::GetInstance();
SGD::AudioManager * pAudio = SGD::AudioManager::GetInstance();
// Press Escape to quit
if (pInput->IsKeyPressed(SGD::Key::Escape) == true || pInput->IsButtonPressed(0, 9) == true || pInput->IsButtonPressed(0, 2) == true)
{
//COMMENT IN WHEN AUDIO ADDED
pAudio->StopAudio(m_hEmergency);
Game::GetInstance()->RemoveState();
Game::GetInstance()->AddState(GameplayState::GetInstance());
return true;
}
// keep playing
return true;
}
示例3: if
// Update
/*virtual*/ void IntroState::Update(float elapsedTime)
{
SGD::AudioManager * pAudio = SGD::AudioManager::GetInstance();
if (IntroTimer.GetTime() < 0.0f)
{
pAudio->StopAudio(m_hEmergency);
Game::GetInstance()->RemoveState();
Game::GetInstance()->AddState(GameplayState::GetInstance());
}
if (IntroTimer.GetTime() < 25.0f)
{
if (ScreenTimer.GetTime() <= 0.0f && IntroTimer.GetTime() > 12.0f)
{
transBack -= 5;
transTextFirst += 5;
ScreenTimer.AddTime(.1f);
}
else if (IntroTimer.GetTime() < 12.0f)
{
if (ScreenTimer.GetTime() < 0.0f)
{
transText += 5;
transTextFirst -= 5;
ScreenTimer.AddTime(.1f);
}
//ScreenTimer.Update(elapsedTime);
}
ScreenTimer.Update(elapsedTime);
}
if (transBack <= 0)
{
transBack = 0;
}
if (transText >= 255)
{
transText = 255;
}
if (transTextFirst >= 255)
{
transTextFirst = 255;
}
if (transTextFirst < 0)
{
transTextFirst = 0;
}
IntroTimer.Update(elapsedTime);
/*
AnimationManager::GetInstance()->Update(animation, elapsedTime);
if (starting_y == 120.0f)
{
Game::GetInstance()->RemoveState();
Game::GetInstance()->AddState(GameplayState::GetInstance());
}
starting_y -= SCROLL_SPEED * elapsedTime;
if (starting_y < 120.0f)
starting_y = 120.0f;
*/
}