[add] Npc 배치

This commit is contained in:
Chanbin Kim
2026-01-12 16:03:01 +09:00
parent a8292a05f5
commit ff07f8148b
7 changed files with 69 additions and 31 deletions
@@ -18,6 +18,7 @@
#include "InstancedProp_Light.h"
#include "Layer.h"
#include "EffectParts.h"
#include "RandomNpc.h"
CMapInfo::CMapInfo()
{
@@ -853,6 +854,47 @@ HRESULT CMapInfo::Load_DADA_INT()
return S_OK;
}
HRESULT CMapInfo::Load_Npc()
{
tinyxml2::XMLDocument xmlDoc;
string strPath = "../Bin/Resources/Data/Map/NPC/DummyNPC_Data.xml";
if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str())))
return E_FAIL;
tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("NPC");
if (nullptr == root)
{
MSG_BOX("Failed to Find root");
return S_OK;
}
for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object"))
{
CRandomNpc::NPCDESC NPCDesc{};
Object->QueryIntAttribute("Index", &NPCDesc.iIndex);
/* Transform */
auto* Position = Object->FirstChildElement("Position");
Position->QueryFloatAttribute("x", &NPCDesc.vPos.x);
Position->QueryFloatAttribute("y", &NPCDesc.vPos.y);
Position->QueryFloatAttribute("z", &NPCDesc.vPos.z);
NPCDesc.vPos.w = 1.f;
auto* Rotation = Object->FirstChildElement("Rotation");
Rotation->QueryFloatAttribute("x", &NPCDesc.vRotQ.x);
Rotation->QueryFloatAttribute("y", &NPCDesc.vRotQ.y);
Rotation->QueryFloatAttribute("z", &NPCDesc.vRotQ.z);
NPCDesc.vRotQ.w = 1.f;
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CRandomNpc>(g_iStaticLevel, NEXT_LEVEL, LAYER_NPC, &NPCDesc))) {
return E_FAIL;
}
}
return S_OK;
}
HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex)
{
m_pGameInstance = CGameInstance::GetInstance();