本文整理汇总了C++中IEntitySoundProxy::SetStaticSound方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntitySoundProxy::SetStaticSound方法的具体用法?C++ IEntitySoundProxy::SetStaticSound怎么用?C++ IEntitySoundProxy::SetStaticSound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntitySoundProxy
的用法示例。
在下文中一共展示了IEntitySoundProxy::SetStaticSound方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StopSound
//------------------------------------------------------------------------
void CItem::StopSound(tSoundID id)
{
if(id == INVALID_SOUNDID)
return;
bool synchSound = false;
IEntitySoundProxy *pSoundProxy = GetSoundProxy(false);
if(pSoundProxy)
{
for(TInstanceActionMap::iterator it = m_instanceActions.begin(); it != m_instanceActions.end(); ++it)
{
SInstanceAction &action = it->second;
for(int i=0; i<2; i++)
{
if(action.sound[i].id == id)
{
pSoundProxy->SetStaticSound(id, false);
action.sound[i].id = INVALID_SOUNDID;
synchSound = action.sound[i].synch;
break;
}
}
}
if(synchSound)
pSoundProxy->StopSound(id, ESoundStopMode_OnSyncPoint);
else
pSoundProxy->StopSound(id);
}
}
示例2: ReleaseStaticSound
//------------------------------------------------------------------------
void CItem::ReleaseStaticSound(SInstanceAudio *sound)
{
if (sound->id != INVALID_SOUNDID)
{
IEntitySoundProxy *pSoundProxy = GetSoundProxy(false);
if (pSoundProxy)
{
pSoundProxy->SetStaticSound(sound->id, false);
if(sound->synch)
pSoundProxy->StopSound(sound->id,ESoundStopMode_OnSyncPoint);
else
pSoundProxy->StopSound(sound->id);
sound->id = INVALID_SOUNDID;
#ifndef ITEM_USE_SHAREDSTRING
sound->static_name.resize(0);
#else
sound->static_name.reset();
#endif
}
}
}
示例3: Quiet
//------------------------------------------------------------------------
void CItem::Quiet()
{
IEntitySoundProxy *pSoundProxy = GetSoundProxy(false);
if (pSoundProxy)
{
for (TInstanceActionMap::iterator it = m_instanceActions.begin(); it != m_instanceActions.end(); ++it)
{
SInstanceAction &action = it->second;
for (int i=0;i<2;i++)
{
if (action.sound[i].id != INVALID_SOUNDID)
{
pSoundProxy->SetStaticSound(action.sound[i].id, false);
action.sound[i].id = INVALID_SOUNDID;
}
}
}
pSoundProxy->StopAllSounds();
}
}
示例4: PlayAction
//.........这里部分代码省略.........
else
{
SInstanceAudio *pInstanceAudio=0;
if(action.sound[sid].isstatic)
{
TInstanceActionMap::iterator iit = m_instanceActions.find(CONST_TEMPITEM_STRING(actionName));
if(iit == m_instanceActions.end())
{
std::pair<TInstanceActionMap::iterator, bool> insertion=m_instanceActions.insert(TInstanceActionMap::value_type(actionName, SInstanceAction()));
pInstanceAudio=&insertion.first->second.sound[sid];
}
else
pInstanceAudio=&iit->second.sound[sid];
}
if(pInstanceAudio && (pInstanceAudio->id != INVALID_SOUNDID) && (name != pInstanceAudio->static_name))
ReleaseStaticSound(pInstanceAudio);
if(!pInstanceAudio || pInstanceAudio->id == INVALID_SOUNDID)
{
result = pSoundProxy->PlaySoundEx(name, vOffset, FORWARD_DIRECTION, nSoundFlags, 1.0f, 0, 0, eSoundSemantic_Weapon, pSkipEnts, nSkipEnts);
ISound *pSound = pSoundProxy->GetSound(result);
if(pSound && action.sound[sid].sphere>0.0f)
pSound->SetSphereSpec(action.sound[sid].sphere);
}
if(action.sound[sid].isstatic)
{
if(pInstanceAudio->id == INVALID_SOUNDID)
{
if(pSoundProxy->SetStaticSound(result, true))
{
pInstanceAudio->id = result;
pInstanceAudio->static_name = name;
pInstanceAudio->synch = action.sound[sid].issynched;
}
}
else
{
ISound *pSound = pSoundProxy->GetSound(pInstanceAudio->id);
if(pSound)
pSound->Play(1.0, true, true, pSoundProxy);
}
}
}
if(gEnv->pAISystem && action.sound[sid].airadius > 0.0f)
{
EntityId ownerId = GetOwner() ? GetOwner()->GetId() : 0;
// associate sound event with vehicle if the shooter is in a vehicle (tank cannon shot, etc)
if(CActor *pOwnerActor = GetOwnerActor())
{
IVehicle *pOwnerVehicle = pOwnerActor->GetLinkedVehicle();
if(pOwnerVehicle && pOwnerVehicle->GetEntityId())
ownerId = pOwnerVehicle->GetEntityId();
}
SAIStimulus stim(AISTIM_SOUND, AISOUND_WEAPON, ownerId?ownerId:GetEntityId() , 0,
GetEntity()->GetWorldPos(), ZERO, action.sound[sid].airadius);