本文整理汇总了C++中CGameObject::FinalizeCreation方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameObject::FinalizeCreation方法的具体用法?C++ CGameObject::FinalizeCreation怎么用?C++ CGameObject::FinalizeCreation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameObject
的用法示例。
在下文中一共展示了CGameObject::FinalizeCreation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InstantiatePrototype
CGameObject* CFactory::InstantiatePrototype(const string &AProtoName, const string &AName /*= ""*/)
{
CXMLNode *xml = GetPrototypeXML(AProtoName);
if (!xml)
{
Log("ERROR", "Can't create prototype instance: no such prototype: '%s'", AProtoName.c_str());
return NULL;
}
CGameObject *result = New<CGameObject>(AName);
if (AName.empty())
result->SetName(AProtoName + itos(result->GetID()));
result->Prototype = true;
result->Deserialize(xml);
SetRecursionLimit(AProtoName, from_string<int>(xml->SafeGetAttribute("RecursionLimit", "-1")));
TraversePrototypeNode(xml, result, result);
result->FinalizeCreation();
Log("INFO", "Prototype INSTANTIATED: '%s', instance name: '%s'", AProtoName.c_str(), result->GetName().c_str());
return result;
}
示例2: TraversePrototypeNode
void CFactory::TraversePrototypeNode(CXMLNode *ANode, CGameObject *AObject, CGameObject *CurrentProto)
{
CGameObject *child;
string NodeName;
string ChildName;
string LocalChildName;
for (CXMLChildrenList::Iterator it = ANode->Children.Begin(); it != ANode->Children.End(); ++it)
{
if ((*it)->GetType() != CXMLNode::XML_NODE_TYPE_NORMAL)
continue;
NodeName = (*it)->GetName();
int recursionsLeft = GetRecursionsLeft(NodeName);
if (recursionsLeft < 1)
{
if (recursionsLeft == -1)
Log("ERROR", "Unlimited recursive reference of prototype '%s'", NodeName.c_str());
continue;
}
IncreaseUsedCount(NodeName);
ChildName = (*it)->SafeGetAttribute("Name");
LocalChildName = (*it)->SafeGetAttribute("LocalName");
child = CreateGameObject(NodeName, ChildName, false);
if (!child)
{
Log("ERROR", "Can't create object of class '%s' from prototype", NodeName.c_str());
continue;
}
CurrentProto->AddLocalName(LocalChildName, child);
child->Deserialize(*it);
AObject->Attach(child);
if (!child->IsPrototype())
child->FinalizeCreation();
TraversePrototypeNode(*it, child, CurrentProto);
DecreaseUsedCount(NodeName);
}
}
示例3: CreateComponent
CGameObject* CFactory::CreateComponent(const string &AClassName, const string &AName /*= ""*/, bool AFinalizeCreation /*= true*/)
{
ComponentsContainer::iterator it = Components.find(AClassName);
if (it == Components.end())
{
Log("ERROR", "Can't create component: no such component class: '%s'", AClassName.c_str());
return NULL;
}
CGameObject *result = dynamic_cast<CGameObject *>((this->*(it->second))(AName));
if (AFinalizeCreation)
result->FinalizeCreation();
return result;
}
示例4: CloneTree
CGameObject* CGameObject::CloneTree(const string &ACloneName /*= ""*/, AlreadyClonedContainer *AlreadyCloned /*= NULL*/) const
{
CGameObject *result = Clone(ACloneName);
map<CGameObject *, CGameObject *> *FirstAlreadyCloned = NULL;
if (!AlreadyCloned)
AlreadyCloned = FirstAlreadyCloned = new AlreadyClonedContainer;
CGameObject *obj = NULL;
for (LNOMType::const_iterator it = LocalNameObjectMapping.begin(); it != LocalNameObjectMapping.end(); ++it)
{
obj = it->second->CloneTree("", AlreadyCloned);
result->LocalNameObjectMapping[it->first] = obj;
(*AlreadyCloned)[it->second] = obj;
}
for (ChildrenConstIterator it = Children.begin(); it != Children.end(); ++it)
{
if (AlreadyCloned->count(*it))
obj = (*AlreadyCloned)[*it];
else
obj = (*it)->CloneTree("", AlreadyCloned);
result->Attach(obj);
}
if (IsPrototype())
result->FinalizeCreation();
if (FirstAlreadyCloned)
delete FirstAlreadyCloned;
return result;
}