本文整理汇总了C++中TrackObject::getDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackObject::getDistance方法的具体用法?C++ TrackObject::getDistance怎么用?C++ TrackObject::getDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackObject
的用法示例。
在下文中一共展示了TrackObject::getDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
/** General update function called once per frame.
* \param dt Time step size.
*/
void OverWorld::update(float dt)
{
// Skip annoying waiting without a purpose
// Make sure to do all things that would normally happen in the
// update() method of the base classes.
if (getPhase() < GO_PHASE)
{
setPhase(RACE_PHASE);
// Normally done in WorldStatus::update(), during phase SET_PHASE,
// so we have to start music 'manually', since we skip all phases.
World::getWorld()->getTrack()->startMusic();
if (music_manager->getCurrentMusic() != NULL &&
UserConfigParams::m_music)
music_manager->getCurrentMusic()->startMusic();
m_karts[0]->startEngineSFX();
}
WorldWithRank::update(dt);
WorldWithRank::updateTrack(dt);
const unsigned int kart_amount = m_karts.size();
// isn't it cool, on the overworld nitro is free!
for(unsigned int n=0; n<kart_amount; n++)
{
m_karts[n]->setEnergy(100.0f);
}
TrackObjectManager* tom = getTrack()->getTrackObjectManager();
PtrVector<TrackObject>& objects = tom->getObjects();
for(unsigned int i=0; i<objects.size(); i++)
{
TrackObject* obj = objects.get(i);
if(!obj->isGarage())
continue;
float m_distance = obj->getDistance();
Vec3 m_garage_pos = obj->getPosition();
Vec3 m_kart_pos = getKart(0)->getXYZ();
if ((m_garage_pos-m_kart_pos).length_2d() > m_distance)
{
obj->reset();
}
}
if (m_return_to_garage)
{
m_return_to_garage = false;
delayedSelfDestruct();
race_manager->exitRace(false);
KartSelectionScreen* s = OfflineKartSelectionScreen::getInstance();
s->setMultiplayer(false);
s->setFromOverworld(true);
StateManager::get()->resetAndGoToScreen(s);
}
} // update