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


C++ IshipIGC::GetMountedPart方法代码示例

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


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

示例1: LoadUniverse

//------------------------------------------------------------------------------
void        Mission4::CreateUniverse (void)
{
    LoadUniverse ("training_3", 486, 1030);    // an advanced stealth fighter

    // stuff for setup
    IshipIGC*           pShip = trekClient.GetShip();

    // set a global attribute to increase the overall energy of the ship
    IsideIGC*           pSide = pShip->GetSide ();
    GlobalAttributeSet  gas = pSide->GetGlobalAttributeSet ();
    gas.SetAttribute (c_gaMaxEnergy, 10.0f);
    pSide->SetGlobalAttributeSet (gas);

    // put the commander ship in the station
    ImissionIGC*        pCore = trekClient.GetCore();
    ImodelIGC*          pStation = pCore->GetModel (OT_station, 1030);
    IshipIGC*           pCommander = pCore->GetShip (m_commanderID);
    pCommander->SetStation (static_cast<IstationIGC*> (pStation));
    pCommander->SetCommand (c_cmdAccepted, NULL, c_cidDoNothing);
    pCommander->SetCommand (c_cmdCurrent, NULL, c_cidDoNothing);
    pCommander->SetAutopilot (false);

    // activate all the starting weapons
    trekClient.fGroupFire = true;

    // take the missiles off the ship
    IpartIGC*           pPart = pShip->GetMountedPart (ET_Magazine, 0);
    if (pPart)
        pPart->Terminate ();

}
开发者ID:borgified,项目名称:Allegiance,代码行数:32,代码来源:mission4.cpp

示例2: if

//------------------------------------------------------------------------------
void        DoDamageAction::Execute (void)
{
    IshipIGC*   pShip = trekClient.GetShip ();
    if (not m_bHull)
    {
        IshieldIGC* pShield = static_cast<IshieldIGC*> (pShip->GetMountedPart (ET_Shield, 0));
        if (pShield and (pShield->GetFraction () > 0.2f))
            pShip->ReceiveDamage (c_dmgidCollision, pShield->GetMaxStrength () * 0.03f, Time::Now (), Vector (-1.0f, 0.0f, 0.0f), Vector (1.0f, 0.0f, 0.0f), 0);

    }
    else
    {
        IshieldIGC* pShield = static_cast<IshieldIGC*> (pShip->GetMountedPart (ET_Shield, 0));
        if (pShield and (pShield->GetFraction () > 0.25f))
            pShield->SetFraction (0.2f);
        else if (pShip->GetFraction () > 0.5f)
            pShip->ReceiveDamage (c_dmgidCollision, 7.5f, Time::Now (), Vector (-1.0f, 0.0f, 0.0f), Vector (1.0f, 0.0f, 0.0f), 0);
    }
}
开发者ID:borgified,项目名称:Allegiance,代码行数:20,代码来源:DoDamageAction.cpp

示例3:

    //------------------------------------------------------------------------------
    void        RepairRearmAction::Execute (void)
    {
        IshipIGC*   pShip = trekClient.GetShip ();

        // heal the ship entirely
        IshieldIGC* pShield = static_cast<IshieldIGC*> (pShip->GetMountedPart (ET_Shield, 0));
        if (pShield)
            pShield->SetFraction (1.0f);
        pShip->SetFraction (1.0f);

        // reload the ammunition, energy, and fuel
        pShip->SetEnergy (pShip->GetHullType ()->GetMaxEnergy ());
        pShip->SetAmmo (pShip->GetHullType ()->GetMaxAmmo ());
        pShip->SetFuel (pShip->GetHullType ()->GetMaxFuel ());

		// mdvalley: i needs defining outside the fors

		int i;

        // fill the first empty cargo slot with missiles
        for (i = -1; i > -c_maxCargo; i--)
            if (pShip->GetMountedPart (NA, i) == 0)
            {
                g_pMission->AddPartToShip (150, i, 0x7fff);
                break;
            }

        // fill the second empty cargo slot with ammo
        for (; i > -c_maxCargo; i--)
            if (pShip->GetMountedPart (NA, i) == 0)
                g_pMission->AddPartToShip (24, i, 0x7fff);

        // fill all subsequent slots with missiles
        for (; i > -c_maxCargo; i--)
            if (pShip->GetMountedPart (NA, i) == 0)
                g_pMission->AddPartToShip (150, i, 0x7fff);
    }
开发者ID:borgified,项目名称:Allegiance,代码行数:38,代码来源:RepairRearmAction.cpp

示例4:

    //------------------------------------------------------------------------------
    void        SetDroneNanAction::Execute (void)
    {
		IshipIGC*		nanShip = trekClient.GetSide()->GetShip(nanShipID);
		IpartIGC*       pPart = nanShip->GetMountedPart (ET_Weapon, 0);
		if (pPart)
			pPart->Terminate ();

		// Stick Nanite 2 on the front
		PartData        pd;
        pd.partID = 190;
        pd.mountID = 0;
        pd.amount = 0;
        nanShip->CreateAndAddPart (&pd);

    }
开发者ID:borgified,项目名称:Allegiance,代码行数:16,代码来源:SetDroneNanAction.cpp


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