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


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

本文整理汇总了C++中AbstractKart::flyDown方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractKart::flyDown方法的具体用法?C++ AbstractKart::flyDown怎么用?C++ AbstractKart::flyDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AbstractKart的用法示例。


在下文中一共展示了AbstractKart::flyDown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleStaticAction

//-----------------------------------------------------------------------------
void InputManager::handleStaticAction(int key, int value)
{
    static bool control_is_pressed = false;
    World *world = World::getWorld();

    // When no players... a cutscene
    if (race_manager->getNumPlayers() == 0 && world != NULL && value > 0 &&
        (key == KEY_SPACE || key == KEY_RETURN))
    {
        world->onFirePressed(NULL);
    }

    switch (key)
    {
#ifdef DEBUG
        // Special debug options for profile mode: switch the 
        // camera to show a different kart.
        case KEY_KEY_1:
        case KEY_KEY_2:
        case KEY_KEY_3:
        case KEY_KEY_4:
        case KEY_KEY_5:
        case KEY_KEY_6:
        case KEY_KEY_7:
        case KEY_KEY_8:
        case KEY_KEY_9:
        {
            if(!ProfileWorld::isProfileMode() || !world) break;
            int kart_id = key - KEY_KEY_1;
            if(kart_id<0 || kart_id>=(int)world->getNumKarts()) break;
            for(unsigned int i=0; i<world->getNumKarts(); i++)
            {
                if(world->getKart(i)->getCamera())
                {
                    world->getKart(i)->getCamera()
                                     ->changeOwner(world->getKart(kart_id));

                }
            }
            break;
        }
#endif
        case KEY_CONTROL:
        case KEY_RCONTROL:
        case KEY_LCONTROL:
        case KEY_RMENU:
        case KEY_LMENU:
        case KEY_LWIN:
            control_is_pressed = value!=0;
            break;

        case KEY_KEY_I:
        {
            if (!world || !UserConfigParams::m_artist_debug_mode) break;
            
            AbstractKart* kart = world->getLocalPlayerKart(0);
            if (kart == NULL) break;
            
            kart->flyUp();
            break;
        }
        case KEY_KEY_K:
        {
            if (!world || !UserConfigParams::m_artist_debug_mode) break;
            
            AbstractKart* kart = world->getLocalPlayerKart(0);
            if (kart == NULL) break;
            
            kart->flyDown();
            break;
        }
        case KEY_PRINT:
            if (value != 0)
                irr_driver->requestScreenshot();
            break;
            
        case KEY_F1:
            if (UserConfigParams::m_artist_debug_mode && world)
            {
                AbstractKart* kart = world->getLocalPlayerKart(0);
                kart->setPowerup(PowerupManager::POWERUP_BUBBLEGUM, 10000);
#ifdef FORCE_RESCUE_ON_FIRST_KART
                // Can be useful for debugging places where the AI gets into
                // a rescue loop: rescue, drive, crash, rescue to same place
                world->getKart(0)->forceRescue();
#endif
                // FIXME: remove after testing the animated plunger
                world->getLocalPlayerKart(0)->blockViewWithPlunger();
            }
            break;
        case KEY_F2:
            if (UserConfigParams::m_artist_debug_mode && world)
            {
                AbstractKart* kart = world->getLocalPlayerKart(0);
                kart->setPowerup(PowerupManager::POWERUP_PLUNGER, 10000);
            }
            break;
        case KEY_F3:
            if (UserConfigParams::m_artist_debug_mode && world)
//.........这里部分代码省略.........
开发者ID:langresser,项目名称:stk,代码行数:101,代码来源:input_manager.cpp

示例2: handleStaticAction

//-----------------------------------------------------------------------------
void InputManager::handleStaticAction(int key, int value)
{
    static bool control_is_pressed = false;
    World *world = World::getWorld();

    // When no players... a cutscene
    if (race_manager->getNumPlayers() == 0 && world != NULL && value > 0 &&
        (key == KEY_SPACE || key == KEY_RETURN))
    {
        world->onFirePressed(NULL);
    }


    if (world != NULL && UserConfigParams::m_artist_debug_mode && 
        control_is_pressed && value > 0)
    {
        if (Debug::handleStaticAction(key))
            return;
    }

    // TODO: move debug shortcuts to Debug::handleStaticAction
    switch (key)
    {
#ifdef DEBUG
        // Special debug options for profile mode: switch the
        // camera to show a different kart.
        case KEY_KEY_1:
        case KEY_KEY_2:
        case KEY_KEY_3:
        case KEY_KEY_4:
        case KEY_KEY_5:
        case KEY_KEY_6:
        case KEY_KEY_7:
        case KEY_KEY_8:
        case KEY_KEY_9:
        {
            if(!ProfileWorld::isProfileMode() || !world) break;
            int kart_id = key - KEY_KEY_1;
            if(kart_id<0 || kart_id>=(int)world->getNumKarts()) break;
            Camera::getCamera(0)->setKart(world->getKart(kart_id));
            break;
        }
#endif

        case KEY_CONTROL:
        case KEY_RCONTROL:
        case KEY_LCONTROL:
        case KEY_RMENU:
        case KEY_LMENU:
        case KEY_LWIN:
            control_is_pressed = value!=0;
            break;

        // Flying up and down
        case KEY_KEY_I:
        {
            if (!world || !UserConfigParams::m_artist_debug_mode) break;

            AbstractKart* kart = world->getLocalPlayerKart(0);
            if (kart == NULL) break;

            kart->flyUp();
            break;
        }
        case KEY_KEY_K:
        {
            if (!world || !UserConfigParams::m_artist_debug_mode) break;

            AbstractKart* kart = world->getLocalPlayerKart(0);
            if (kart == NULL) break;

            kart->flyDown();
            break;
        }
        // Moving the first person camera
        case KEY_KEY_W:
        {
            if (world && UserConfigParams::m_artist_debug_mode &&
                Camera::isFPS()                                   )
            {
                Camera *cam = Camera::getActiveCamera();
                core::vector3df vel(cam->getLinearVelocity());
                vel.Z = value ? cam->getMaximumVelocity() : 0;
                cam->setLinearVelocity(vel);
            }
            break;
        }
        case KEY_KEY_S:
        {
            if (world && UserConfigParams::m_artist_debug_mode && 
                Camera::isFPS()                                   )
            {
                Camera *cam = Camera::getActiveCamera();
                core::vector3df vel(cam->getLinearVelocity());
                vel.Z = value ? -cam->getMaximumVelocity() : 0;
                cam->setLinearVelocity(vel);
            }
            break;
        }
//.........这里部分代码省略.........
开发者ID:christopher1215,项目名称:stk-code,代码行数:101,代码来源:input_manager.cpp


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