[add] 상호작용 오브젝트 추가, 배치
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "MapObject_Render.h"
|
||||
#include "MapObject_Collision.h"
|
||||
#include "MapElement_Light.h"
|
||||
#include "MapElement_Interactable.h"
|
||||
#include "Layer.h"
|
||||
|
||||
CMapInfo::CMapInfo()
|
||||
@@ -392,8 +393,72 @@ HRESULT CMapInfo::Load_LightElements(const _char* pFileName)
|
||||
MSG_BOX("Successed to Load File");
|
||||
#endif
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapInfo::Load_InteractableElements(const _char* pFileName)
|
||||
{
|
||||
tinyxml2::XMLDocument xmlDoc;
|
||||
|
||||
string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml";
|
||||
|
||||
if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str())))
|
||||
return E_FAIL;
|
||||
|
||||
tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Element_Interactable");
|
||||
|
||||
if (nullptr == root)
|
||||
{
|
||||
MSG_BOX("Failed to Find root");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object"))
|
||||
{
|
||||
CMapElement_Interactable::ELEMENT_INTERACTABLE_DESC Desc = {};
|
||||
|
||||
/* Model Prototypes */
|
||||
Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel);
|
||||
Object->QueryUnsignedAttribute("Lod_Level", &Desc.iInteractableID);
|
||||
|
||||
string strTag = {};
|
||||
for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag"))
|
||||
{
|
||||
strTag = PrototypeTag->GetText();
|
||||
|
||||
Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag));
|
||||
}
|
||||
|
||||
/* Transform */
|
||||
auto* Position = Object->FirstChildElement("Position");
|
||||
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
|
||||
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
|
||||
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
|
||||
|
||||
auto* Scale = Object->FirstChildElement("Scale");
|
||||
Scale->QueryFloatAttribute("x", &Desc.vScale.x);
|
||||
Scale->QueryFloatAttribute("y", &Desc.vScale.y);
|
||||
Scale->QueryFloatAttribute("z", &Desc.vScale.z);
|
||||
|
||||
auto* Rotation = Object->FirstChildElement("Rotation");
|
||||
Rotation->QueryFloatAttribute("x", &Desc.vRotation.x);
|
||||
Rotation->QueryFloatAttribute("y", &Desc.vRotation.y);
|
||||
Rotation->QueryFloatAttribute("z", &Desc.vRotation.z);
|
||||
|
||||
auto* HalfGeometryInfo = Object->FirstChildElement("HalfGeometryInfo");
|
||||
HalfGeometryInfo->QueryFloatAttribute("x", &Desc.vBoxSize.x);
|
||||
HalfGeometryInfo->QueryFloatAttribute("y", &Desc.vBoxSize.y);
|
||||
HalfGeometryInfo->QueryFloatAttribute("z", &Desc.vBoxSize.z);
|
||||
|
||||
auto* LocalTranslation = Object->FirstChildElement("LocalTranslation");
|
||||
LocalTranslation->QueryFloatAttribute("x", &Desc.vBoxLocalPosition.x);
|
||||
LocalTranslation->QueryFloatAttribute("y", &Desc.vBoxLocalPosition.y);
|
||||
LocalTranslation->QueryFloatAttribute("z", &Desc.vBoxLocalPosition.z);
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CMapElement_Interactable>(g_iStaticLevel, NEXT_LEVEL, LAYER_INTERACTABLE, &Desc)))
|
||||
return E_FAIL;
|
||||
}
|
||||
//MSG_BOX("Successed to Create Interactalbe Element");
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user