当前位置: 首页>>代码示例>>C++>>正文


C++ AbstractKart::eliminate方法代码示例

本文整理汇总了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
开发者ID:kiennguyen1994,项目名称:game-programming-cse-hcmut-2012,代码行数:43,代码来源:world.cpp


注:本文中的AbstractKart::eliminate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。