本文整理汇总了C++中AbstractKart::eliminate方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractKart::eliminate方法的具体用法?C++ AbstractKart::eliminate怎么用?C++ AbstractKart::eliminate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractKart
的用法示例。
在下文中一共展示了AbstractKart::eliminate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eliminateKart
/** Remove (eliminate) a kart from the race */
void World::eliminateKart(int kart_number, bool notify_of_elimination)
{
AbstractKart *kart = m_karts[kart_number];
// Display a message about the eliminated kart in the race gui
if (notify_of_elimination)
{
for (KartList::iterator i = m_karts.begin(); i != m_karts.end(); i++ )
{
if(!(*i)->getCamera()) continue;
if(*i==kart)
{
m_race_gui->addMessage(_("You have been eliminated!"), *i,
2.0f);
}
else
{
m_race_gui->addMessage(_("'%s' has been eliminated.",
core::stringw(kart->getName())), *i,
2.0f);
}
} // for i in kart
}
if(kart->getController()->isPlayerController())
{
// Change the camera so that it will be attached to the leader
// and facing backwards.
Camera* camera=kart->getCamera();
camera->setMode(Camera::CM_LEADER_MODE);
m_eliminated_players++;
}
// The kart can't be really removed from the m_kart array, since otherwise
// a race can't be restarted. So it's only marked to be eliminated (and
// ignored in all loops). Important:world->getCurrentNumKarts() returns
// the number of karts still racing. This value can not be used for loops
// over all karts, use race_manager->getNumKarts() instead!
kart->eliminate();
m_eliminated_karts++;
} // eliminateKart