[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 };
|
||||
|
||||
@@ -1,66 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<NPC>
|
||||
<Object ID="13">
|
||||
<Position x="7.1631966" y="-13.129012" z="-29.87093"/>
|
||||
<Object ID="13" Index="4">
|
||||
<Position x="7.1631966" y="-10.129012" z="-29.87093"/>
|
||||
<Scale x="0.99811238" y="1" z="0.99811238"/>
|
||||
<Rotation x="0" y="214" z="0"/>
|
||||
</Object>
|
||||
<Object ID="0">
|
||||
<Position x="32.72155" y="3.801733" z="74.733856"/>
|
||||
<Scale x="0.99974245" y="1" z="0.99974245"/>
|
||||
<Rotation x="0" y="129" z="0"/>
|
||||
</Object>
|
||||
<Object ID="1">
|
||||
<Object ID="1" Index="1">
|
||||
<Position x="47.214542" y="4.2283616" z="82.240288"/>
|
||||
<Scale x="0.99857348" y="1" z="0.99857348"/>
|
||||
<Rotation x="0" y="150" z="0"/>
|
||||
<Rotation x="0" y="120" z="0"/>
|
||||
</Object>
|
||||
<Object ID="2">
|
||||
<Object ID="2" Index="0">
|
||||
<Position x="48.645473" y="4.2111044" z="80.637032"/>
|
||||
<Scale x="0.99998683" y="1" z="0.99998683"/>
|
||||
<Rotation x="0" y="287" z="0"/>
|
||||
</Object>
|
||||
<Object ID="3">
|
||||
<Position x="91.189796" y="15.22409" z="129.24487"/>
|
||||
<Scale x="0.99990129" y="1" z="0.99990129"/>
|
||||
<Rotation x="0" y="90" z="0"/>
|
||||
</Object>
|
||||
<Object ID="5">
|
||||
<Object ID="5" Index="2">
|
||||
<Position x="40.331745" y="6.6973305" z="99.171661"/>
|
||||
<Scale x="0.99978107" y="1" z="0.99978107"/>
|
||||
<Rotation x="0" y="160" z="0"/>
|
||||
</Object>
|
||||
<Object ID="6">
|
||||
<Object ID="6" Index="3">
|
||||
<Position x="90.164291" y="15.802738" z="142.52655"/>
|
||||
<Scale x="1.0003461" y="1" z="1.0003461"/>
|
||||
<Rotation x="0" y="135" z="0"/>
|
||||
</Object>
|
||||
<Object ID="7">
|
||||
<Object ID="7" Index="5">
|
||||
<Position x="114.85642" y="15.469075" z="116.20981"/>
|
||||
<Scale x="0.99999529" y="1" z="0.99999529"/>
|
||||
<Rotation x="0" y="315" z="0"/>
|
||||
</Object>
|
||||
<Object ID="8">
|
||||
<Position x="125.50824" y="15.934627" z="141.39334"/>
|
||||
<Scale x="0.99993688" y="1" z="0.99993688"/>
|
||||
<Rotation x="0" y="195" z="0"/>
|
||||
</Object>
|
||||
<Object ID="9">
|
||||
<Object ID="9" Index="7">
|
||||
<Position x="35.15633" y="1.5198594" z="50.624886"/>
|
||||
<Scale x="0.99999732" y="1" z="0.99999732"/>
|
||||
<Rotation x="0" y="120" z="0"/>
|
||||
</Object>
|
||||
<Object ID="10">
|
||||
<Object ID="10" Index="8">
|
||||
<Position x="129.77383" y="15.728663" z="121.83965"/>
|
||||
<Scale x="0.99999732" y="1" z="0.99999732"/>
|
||||
<Rotation x="0" y="-105" z="0"/>
|
||||
</Object>
|
||||
<Object ID="11">
|
||||
<Object ID="11" Index="9">
|
||||
<Position x="-393.24478" y="-33.342117" z="-362.13519"/>
|
||||
<Scale x="0.9999885" y="1" z="0.9999885"/>
|
||||
<Rotation x="0" y="285" z="0"/>
|
||||
</Object>
|
||||
<Object ID="12">
|
||||
<Object ID="12" Index="10">
|
||||
<Position x="79.841499" y="3.8484674" z="83.004013"/>
|
||||
<Scale x="0.99980307" y="1" z="0.99980307"/>
|
||||
<Rotation x="0" y="210" z="0"/>
|
||||
|
||||
Reference in New Issue
Block a user