[add] Npc 배치
This commit is contained in:
@@ -176,6 +176,10 @@ HRESULT CInfoInstance::Load_DADA_INT()
|
||||
{
|
||||
return m_pMapInfo->Load_DADA_INT();
|
||||
}
|
||||
HRESULT CInfoInstance::Load_Npc()
|
||||
{
|
||||
return m_pMapInfo->Load_Npc();
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region EFFECT_INFO
|
||||
|
||||
@@ -1126,10 +1126,12 @@ HRESULT CLevel_GamePlay::Ready_Layer_Npc()
|
||||
{
|
||||
_bool isLoad_NPC = { true };
|
||||
_bool isLoad_RandomNPC = { true };
|
||||
_bool isRandomPosition = { true };
|
||||
#ifdef _DEBUG
|
||||
#ifdef gimch
|
||||
isLoad_NPC = true;
|
||||
isLoad_RandomNPC = true;
|
||||
isRandomPosition = false;
|
||||
#endif // gimch
|
||||
#ifdef 진우
|
||||
isLoad_RandomNPC = true;
|
||||
@@ -1170,8 +1172,9 @@ HRESULT CLevel_GamePlay::Ready_Layer_Npc()
|
||||
|
||||
if (true == isLoad_RandomNPC)
|
||||
{
|
||||
for (_uint i = 0; i < 11; i++)
|
||||
if(isRandomPosition)
|
||||
{
|
||||
for (_uint i = 0; i < 11; i++)
|
||||
{
|
||||
CRandomNpc::NPCDESC NPCDesc{};
|
||||
_float X = m_pGameInstance->Real_Random_Float(22.f, 29.f);
|
||||
@@ -1184,6 +1187,8 @@ HRESULT CLevel_GamePlay::Ready_Layer_Npc()
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
m_pInfoInstance->Load_Npc();
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -40,9 +40,9 @@ HRESULT CRandomNpc::Initialize(void* pArg)
|
||||
_vector vPos = XMLoadFloat4(&pDesc->vPos);
|
||||
m_pTransformCom->Set_State(STATE::POSITION, vPos);
|
||||
m_pCharacter_Controller->Set_Position(vPos);
|
||||
m_pTransformCom->Rotation(XMLoadFloat4(&pDesc->vRotQ));
|
||||
m_pTransformCom->Rotation(XMConvertToRadians(pDesc->vRotQ.x), XMConvertToRadians(pDesc->vRotQ.y), XMConvertToRadians(pDesc->vRotQ.z));
|
||||
|
||||
m_pModelCom->Set_AnimationIndex(0, true);
|
||||
m_pModelCom->Set_AnimationIndex(1, true);
|
||||
m_pCallBack_Behavior->Initialize(m_pCharacter_Controller);
|
||||
m_pCallBack_HitReport->Initialize(m_pCharacter_Controller);
|
||||
m_bNpc = true;
|
||||
@@ -320,7 +320,7 @@ HRESULT CRandomNpc::Ready_Components(void* pArg)
|
||||
Desc.fRotationPerSec = XMConvertToRadians(180.0f);
|
||||
Desc.fRadius = 10.f;
|
||||
|
||||
if (FAILED(Add_Component<CTransform>(g_iStaticLevel, &m_pTransformCom, pArg))) {
|
||||
if (FAILED(Add_Component<CTransform>(g_iStaticLevel, &m_pTransformCom, &Desc))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ DECLARE_SINGLETON(CInfoInstance)
|
||||
HRESULT Load_PointLights(const _char* pFileName, const _wchar* pLayerTag);
|
||||
HRESULT Load_EffectParts(const _char* pFileName, const _char* pEffectrFilePath);
|
||||
HRESULT Load_DADA_INT();
|
||||
HRESULT Load_Npc();
|
||||
#pragma endregion
|
||||
#pragma region Spell_INFO
|
||||
HRESULT Load_SpellInfo(const _char* pFilePath);
|
||||
|
||||
@@ -32,6 +32,7 @@ class CMapInfo final : public CBase
|
||||
HRESULT Load_EffectParts(const _char* pFileName, const _char* pEffectrFilePath);
|
||||
|
||||
HRESULT Load_DADA_INT();
|
||||
HRESULT Load_Npc();
|
||||
|
||||
private:
|
||||
CGameInstance* m_pGameInstance = { nullptr };
|
||||
|
||||
Reference in New Issue
Block a user