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


C++ CInventory::HasAccessory方法代码示例

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


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

示例1: HasAccessory

//-------------------------------------------------------------------
int CScriptBind_Inventory::HasAccessory(IFunctionHandler *pH, const char *accessoryName)
{
    CInventory *pInventory = GetInventory(pH);
    CRY_ASSERT(pInventory);

    IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(accessoryName);
    if(pClass)
        return pH->EndFunction(pInventory->HasAccessory(pClass));

    return pH->EndFunction();
}
开发者ID:aronarts,项目名称:FireNET,代码行数:12,代码来源:ScriptBind_Inventory.cpp

示例2: OnRecordedGameplayEvent


//.........这里部分代码省略.........
                            IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(sel);
                            if(m_bLogWarning)
                                CheckDifference(ammoCount,pInventory->GetAmmoCount(pClass),"TimeDemo:GameState: Frame %d - Actor %s - AMMO PICKEDUP: count mismatch for ammo class %s (rec:%d, cur:%d)", pEntity,sel);

                            if(demo_forceGameState == 2)
                                pInventory->SetAmmoCount(pClass,ammoCount);
                        }
                    }
                }
            }
            break;

        case eGE_AccessoryPickedUp:
            {
                TItemName sel = (TItemName)event.description;
                //				gstate.itemSelected = sel;
                TAccessoryContainer& Accessories = gstate.Accessories;
                TAccessoryContainer::iterator it = Accessories.find(sel);
                if(it == Accessories.end())
                {
                    Accessories.insert(std::make_pair(sel,1));
                }
                else
                    it->second++;

                CActor *pActor = (CActor*)(gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(id));
                if(pActor)
                {
                    CInventory* pInventory = (CInventory*)(pActor->GetInventory());
                    if(pInventory)
                    {
                        IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(sel);
                        
                        if(m_bLogWarning && !pInventory->HasAccessory(pClass))
                            GameWarning("TimeDemo:GameState: Frame %d - Actor %s - ACCESSORY PICKEDUP %s not found in current inventory", m_currentFrame, pEntity->GetName(),sel ? sel:"(null)");

                        if(demo_forceGameState == 2 && pClass)					
                            pInventory->AddAccessory(pClass);// doesn't actually add it if it's there already

                    }
                }
            }
            break;

        case eGE_ItemDropped:
            {
                TItemName sel = (TItemName)event.description;
                //gstate.itemSelected = sel;
                TItemContainer& Items = gstate.Items;
                TItemContainer::iterator it = Items.find(sel);
                if(it != Items.end())
                {
                    it->second.count--;
                    if(it->second.count<=0)
                        Items.erase(it);

                    if(demo_forceGameState == 2)
                    {
                        CActor *pActor = (CActor*)(gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(id));
                        if(pActor)
                        {
                            CInventory* pInventory = (CInventory*)(pActor->GetInventory());
                            if(pInventory)
                            {
                                IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(sel);
                                if(pClass)
开发者ID:kitnet,项目名称:project-o,代码行数:67,代码来源:GameStateRecorder.cpp


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