本文整理汇总了C++中CKBehavior::GetPrototypeGuid方法的典型用法代码示例。如果您正苦于以下问题:C++ CKBehavior::GetPrototypeGuid方法的具体用法?C++ CKBehavior::GetPrototypeGuid怎么用?C++ CKBehavior::GetPrototypeGuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKBehavior
的用法示例。
在下文中一共展示了CKBehavior::GetPrototypeGuid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTargetCommand
/*
*******************************************************************
* Function: CKBehavior* GetTargetCommand(const int commandId, const CKBehaviorContext& behaviorContext)
*
* Description : Gets target behavior object given the command ID
*
* Paramters :
*
* commandId r command id of the target object to get
* behaviorContext r context
*
* Returns :
* pointer to the behavior object, NULL if no object found
*
*******************************************************************
*/
CKBehavior* CGBLCommandController::GetTargetCommand(const int commandId, const CKBehaviorContext& behaviorContext)
{
CKBehavior* targetBehavior = NULL;
CKContext* context = behaviorContext.Context;
int behaviorCount = context->GetObjectsCountByClassID(CKCID_BEHAVIOR);
CK_ID* behaviorIds = context->GetObjectsListByClassID(CKCID_BEHAVIOR);
int currentID;
for (int i = 0; i < behaviorCount; ++i)
{
CKBehavior* behavior = (CKBehavior*)context->GetObject(behaviorIds[i]);
if (behavior->GetPrototypeGuid() == GUID_GBLWAITFORCOMMAND_PROTOTYPE)
{
CKParameterLocal *localParam = NULL;
localParam = behavior->GetLocalParameter(2); //Get command ID
if (localParam != NULL)
{
localParam->GetValue(¤tID); //Get command ID's value
localParam = NULL;
}
else
{
break;
}
if (currentID == commandId)
{
targetBehavior = behavior;
break;
}
}
}
return targetBehavior;
}