本文整理汇总了C++中Kart::playingEmergencyAnimation方法的典型用法代码示例。如果您正苦于以下问题:C++ Kart::playingEmergencyAnimation方法的具体用法?C++ Kart::playingEmergencyAnimation怎么用?C++ Kart::playingEmergencyAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kart
的用法示例。
在下文中一共展示了Kart::playingEmergencyAnimation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
/** General update function called once per frame. This updates the kart
* sectors, which are then used to determine the kart positions.
* \param dt Time step size.
*/
void LinearWorld::update(float delta)
{
// run generic parent stuff that applies to all modes. It
// especially updates the kart positions.
WorldWithRank::update(delta);
if (m_last_lap_sfx_playing && m_last_lap_sfx->getStatus() != SFXManager::SFX_PLAYING)
{
music_manager->getCurrentMusic()->resetTemporaryVolume();
m_last_lap_sfx_playing = false;
}
const unsigned int kart_amount = getNumKarts();
// Do stuff specific to this subtype of race.
// ------------------------------------------
for(unsigned int n=0; n<kart_amount; n++)
{
KartInfo& kart_info = m_kart_info[n];
Kart* kart = m_karts[n];
// Nothing to do for karts that are currently being rescued or eliminated
if(kart->playingEmergencyAnimation()) continue;
// ---------- deal with sector data ---------
// update sector variables
int prev_sector = kart_info.m_track_sector;
m_track->getQuadGraph().findRoadSector(kart->getXYZ(),
&kart_info.m_track_sector);
kart_info.m_on_road = kart_info.m_track_sector != QuadGraph::UNKNOWN_SECTOR;
if(kart_info.m_on_road)
{
kart_info.m_last_valid_sector = kart_info.m_track_sector;
kart_info.m_last_valid_race_lap = kart_info.m_race_lap;
}
else
{
// Kart off road. Find the closest sector instead.
kart_info.m_track_sector =
m_track->getQuadGraph().findOutOfRoadSector(kart->getXYZ(), prev_sector );
}
// Update track coords (=progression)
m_track->getQuadGraph().spatialToTrack(&kart_info.m_curr_track_coords,
kart->getXYZ(),
kart_info.m_track_sector );
} // for n
// Update all positions. This must be done after _all_ karts have
// updated their position and laps etc, otherwise inconsistencies
// (like two karts at same position) can occur.
// ---------------------------------------------------------------
updateRacePosition();
for (unsigned int i=0; i<kart_amount; i++)
{
// ---------- update rank ------
if (m_karts[i]->hasFinishedRace() || m_karts[i]->isEliminated()) continue;
// During the last lap update the estimated finish time.
// This is used to play the faster music, and by the AI
if (m_kart_info[i].m_race_lap == race_manager->getNumLaps()-1)
{
m_kart_info[i].m_estimated_finish = estimateFinishTimeForKart(m_karts[i]);
}
checkForWrongDirection(i);
}
#ifdef DEBUG
// FIXME: Debug output in case that the double position error occurs again.
std::vector<int> pos_used;
pos_used.resize(kart_amount+1, -99);
for(unsigned int i=0; i<kart_amount; i++)
{
if(pos_used[m_karts[i]->getPosition()]!=-99)
{
for(unsigned int j =0; j<kart_amount; j++)
{
printf("kart id=%d, position=%d, finished=%d, laps=%d, distanceDownTrack=%f %s\n",
j, m_karts[j]->getPosition(),
m_karts[j]->hasFinishedRace(),
m_kart_info[j].m_race_lap,
getDistanceDownTrackForKart(m_karts[j]->getWorldKartId()),
(m_karts[j]->getPosition() == m_karts[i]->getPosition() ? "<--- !!!" : ""));
}
}
pos_used[m_karts[i]->getPosition()]=i;
}
#endif
} // update