[Add] 포션 추가

This commit is contained in:
hyunbin14
2025-12-12 15:01:31 +09:00
parent 9233d4cae0
commit fc4dc71224
10 changed files with 306 additions and 5 deletions
@@ -185,6 +185,7 @@ call Update_Resources.bat
<ClInclude Include="..\Public\InteractiveInfo.h" />
<ClInclude Include="..\Public\Intro_BG.h" />
<ClInclude Include="..\Public\Intro_Image.h" />
<ClInclude Include="..\Public\Item_Potion.h" />
<ClInclude Include="..\public\Land.h" />
<ClInclude Include="..\Public\Levioso.h" />
<ClInclude Include="..\Public\Loding_Panel.h" />
@@ -366,6 +367,7 @@ call Update_Resources.bat
<ClCompile Include="..\Private\InteractiveInfo.cpp" />
<ClCompile Include="..\Private\Intro_BG.cpp" />
<ClCompile Include="..\Private\Intro_Image.cpp" />
<ClCompile Include="..\Private\Item_Potion.cpp" />
<ClCompile Include="..\private\Land.cpp" />
<ClCompile Include="..\Private\Levioso.cpp" />
<ClCompile Include="..\Private\Loding_Panel.cpp" />
@@ -532,7 +532,7 @@
</ClInclude>
<ClInclude Include="..\Public\Barral_Splesh.h">
<Filter>02.GameObjects\Effect\PropsEffect\Barral</Filter>
</ClInclude>
</ClInclude>
<ClInclude Include="..\Public\State_Broom_Hover.h">
<Filter>04.Mechanic\State\Broom_Player\State_Broom_Hover</Filter>
</ClInclude>
@@ -554,6 +554,9 @@
<ClInclude Include="..\public\MapElement_Door.h">
<Filter>02.GameObjects\Environment\03.MapElement\Door</Filter>
</ClInclude>
<ClInclude Include="..\Public\Item_Potion.h">
<Filter>02.GameObjects\Item\Potion</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="Client.ico">
@@ -1148,7 +1151,7 @@
</Filter>
<Filter Include="02.GameObjects\Effect\PropsEffect\Chair">
<UniqueIdentifier>{3103c6e1-60cb-438b-a3eb-844b919ccd43}</UniqueIdentifier>
</Filter>
</Filter>
<Filter Include="04.Mechanic\State\Broom_Player\State_Broom_Hover">
<UniqueIdentifier>{24f6903f-8f6b-46ff-a387-ecb44d673887}</UniqueIdentifier>
</Filter>
@@ -1170,6 +1173,9 @@
<Filter Include="02.GameObjects\Environment\03.MapElement\Door">
<UniqueIdentifier>{b09f9ada-6cf4-41a4-ad28-f00855509825}</UniqueIdentifier>
</Filter>
<Filter Include="02.GameObjects\Item\Potion">
<UniqueIdentifier>{ace6c64f-901a-424e-99da-53f281413d77}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Client.cpp">
@@ -1646,7 +1652,7 @@
</ClCompile>
<ClCompile Include="..\Private\Chair_Splesh.cpp">
<Filter>02.GameObjects\Effect\PropsEffect\Chair</Filter>
</ClCompile>
</ClCompile>
<ClCompile Include="..\Private\State_Broom_Hover.cpp">
<Filter>04.Mechanic\State\Broom_Player\State_Broom_Hover</Filter>
</ClCompile>
@@ -1668,6 +1674,9 @@
<ClCompile Include="..\private\MapElement_Door.cpp">
<Filter>02.GameObjects\Environment\03.MapElement\Door</Filter>
</ClCompile>
<ClCompile Include="..\Private\Item_Potion.cpp">
<Filter>02.GameObjects\Item\Potion</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Private\Goblin_States.cpp">
@@ -0,0 +1,200 @@
#include "pch.h"
#include "Item_Potion.h"
#include "GameInstance.h"
CItem_Potion::CItem_Potion(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CPartObject(pDevice, pContext)
{
}
CItem_Potion::CItem_Potion(const CItem_Potion& Prototype)
: CPartObject(Prototype)
{
}
HRESULT CItem_Potion::Initialize_Prototype()
{
return S_OK;
}
HRESULT CItem_Potion::Initialize(void* pArg)
{
POTION_DESC* pDesc = static_cast<POTION_DESC*> (pArg);
m_pSocketMatrices = pDesc->pSocketMatrices;
if (FAILED(__super::Initialize(pArg))) {
return E_FAIL;
}
if (FAILED(Ready_Components())) {
return E_FAIL;
}
return S_OK;
}
void CItem_Potion::Priority_Update(_float fTimeDelta)
{
#ifdef _DEBUG
Describe_Entity();
#endif // _DEBUG
}
void CItem_Potion::Update(_float fTimeDelta)
{
m_pModelCom->Combined_BoneMatrix();
}
void CItem_Potion::Late_Update(_float fTimeDelta)
{
if (m_bVisible)
{
m_fTimer += fTimeDelta;
if (m_fTimer >= 1.7f) {
m_fTimer = 0.f;
m_bVisible = false;
}
}
if (m_bAttach)
{
_matrix socketMatrix = {};
socketMatrix = XMLoadFloat4x4(m_pSocketMatrices);
for (int i = 0; i < 3; ++i) {
socketMatrix.r[i] = XMVector3Normalize(socketMatrix.r[i]);
}
m_pTransformCom->Set_WorldMatrix(socketMatrix * XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr()));
}
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
}
HRESULT CItem_Potion::Render()
{
if (!m_pModelCom)
return S_OK;
if (!m_bVisible)
return S_OK;
if (FAILED(Bind_ShaderResources())) {
return E_FAIL;
}
_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
for (_uint i = 0; i < iNumMeshes; i++)
{
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) {
return E_FAIL;
}
if (FAILED(m_pModelCom->Render(i))) {
return E_FAIL;
}
}
return S_OK;
}
void CItem_Potion::Set_Attach(_bool Attach)
{
m_bAttach = Attach;
}
HRESULT CItem_Potion::Ready_Components()
{
__super::Ready_Components(nullptr);
/* Com_Model */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Potion_Model"),
reinterpret_cast<CComponent**>(&m_pModelCom))))
return E_FAIL;
/* Com_Shader */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
reinterpret_cast<CComponent**>(&m_pShaderCom))))
return E_FAIL;
return S_OK;
}
HRESULT CItem_Potion::Bind_ShaderResources()
{
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
return E_FAIL;
}
return S_OK;
}
CItem_Potion* CItem_Potion::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CItem_Potion* pInstance = new CItem_Potion(pDevice, pContext);
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CItem_Potion");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
CGameObject* CItem_Potion::Clone(void* pArg, CGameObject* pOwner)
{
CItem_Potion* pInstance = new CItem_Potion(*this);
pInstance->m_pOwner = pOwner;
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CItem_Potion");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
void CItem_Potion::Free()
{
__super::Free();
SAFE_RELEASE(m_pShaderCom);
SAFE_RELEASE(m_pModelCom);
}
#ifdef _DEBUG
void CItem_Potion::Describe_Entity()
{
}
#endif // _DEBUG
+10
View File
@@ -18,6 +18,7 @@
#include "Troll_Rock.h"
#include "Goblin_Dagger.h"
#include "Wand.h"
#include "Item_Potion.h"
#include "Goblin_BattleAxe.h"
#pragma region ACTOR
@@ -1471,6 +1472,11 @@ HRESULT CLoader::Loading_For_GamePlay()
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Wand/Wand.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationX(XMConvertToRadians(-90.f)) * XMMatrixIdentity()))))
return E_FAIL;
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Potion_Model"),
CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Object/Potion/SM_Bottle_EmptyCapOff.bin", XMMatrixIdentity()))))
return E_FAIL;
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Broom_Model"),
CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Object/Broom/Broom.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity()))))
return E_FAIL;
@@ -2188,6 +2194,10 @@ HRESULT CLoader::Loading_For_GamePlay()
if (FAILED(m_pGameInstance->Add_Prototype<CWand>(g_iStaticLevel, CWand::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_Potion */
if (FAILED(m_pGameInstance->Add_Prototype<CItem_Potion>(g_iStaticLevel, CItem_Potion::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_Troll_Weapon */
if (FAILED(m_pGameInstance->Add_Prototype<CTroll_Weapon>(g_iStaticLevel, CTroll_Weapon::Create(m_pDevice, m_pContext))))
return E_FAIL;
+13
View File
@@ -7,6 +7,7 @@
#include "Camera_Gaze.h"
#include "CamPosition_Arm.h"
#include "Wand.h"
#include "Item_Potion.h"
#include "Character_Controller.h"
#include "CallBack_Playable_Behavior.h"
#include "CamPosition_Shoulder.h"
@@ -463,6 +464,18 @@ HRESULT CPlayer::Ready_Parts()
return E_FAIL;
}
CItem_Potion::POTION_DESC PotionDesc{};
PotionDesc.pParentTransform = m_pTransformCom;
PotionDesc.pSocketMatrices = m_pModelCom->Get_BoneMatrixPtr("SKT_LeftHand");
if (FAILED(Add_PartObject<CItem_Potion>("Potion", g_iStaticLevel, nullptr, &PotionDesc)))
{
return E_FAIL;
}
Get_PartObject<CItem_Potion>()->Set_Visible(false);
{
CCamPosition_Shoulder::CAMERA_SHOULDER_DESC Desc;
Desc.pParentTransform = m_pTransformCom;
@@ -8,6 +8,7 @@
#include "Camera_Gaze.h"
#include "CamPosition_Arm.h"
#include "Wand.h"
#include "Item_Potion.h"
#include "Character_Controller.h"
#include "MapElement_Interactable.h"
#include "CallBack_Playable_Behavior.h"
@@ -215,6 +216,7 @@ HRESULT CPlayer::Behavior_IdleExitCheck(_float fTimeDelta)
m_pFSM->Change_State(FSMSTATE::COMBAT);
}
else if (m_pGameInstance->Key_Down(DIK_G)) {
Get_PartObject<CItem_Potion>()->Set_Visible(true);
m_pModelCom->Set_Second_AnimationIndex(ENUM_CLASS(BLEND_BONE::SHOULDER_NECK_L), m_Animation[STATEANIM::POTION].first, m_Animation[STATEANIM::POTION].second);
}
else if (m_pGameInstance->Key_Down(DIK_B)) {
@@ -408,6 +410,7 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
m_pFSM->Change_State(FSMSTATE::COMBAT);
}
else if (m_pGameInstance->Key_Down(DIK_G)) {
Get_PartObject<CItem_Potion>()->Set_Visible(true);
m_pModelCom->Set_Second_AnimationIndex(ENUM_CLASS(BLEND_BONE::SHOULDER_NECK_L), m_Animation[STATEANIM::POTION].first, m_Animation[STATEANIM::POTION].second);
}
@@ -640,6 +643,7 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
return S_OK;
}
if (m_pFSM->IsEnable(FSMSTATE::JOG | FSMSTATE::WALK | FSMSTATE::SPRINT) ||
!SUCCEEDED(InputMove())) {
if (!m_pFSM->IsEnable(FSMSTATE::STOP))
@@ -912,7 +912,7 @@ void CTroll::CheckHammerHits(_uint& iHitCount, vector<PSX::PxSweepHit>& pxHits)
_bool bCollision = false;
m_SweepBufferHammer = {};
bCollision = m_pGameInstance->SphereCast(1.2f, vStartPos, vDir, fDistance, PSX::PxHitFlag::eDEFAULT, PSX::PxQueryFlag::eDYNAMIC, m_SweepBufferHammer);
bCollision = m_pGameInstance->SphereCast(2.f, vStartPos, vDir, fDistance, PSX::PxHitFlag::eDEFAULT, PSX::PxQueryFlag::eDYNAMIC, m_SweepBufferHammer);
if (true == bCollision) {
iHitCount += m_SweepBufferHammer.getNbTouches() + m_SweepBufferHammer.hasBlock;
auto touches = m_SweepBufferHammer.getTouches();
@@ -933,7 +933,7 @@ void CTroll::CheckHammerHits(_uint& iHitCount, vector<PSX::PxSweepHit>& pxHits)
_bool bCollision = false;
m_SweepBufferGrip = {};
bCollision = m_pGameInstance->SphereCast(1.2f, vStartPos, vDir, fDistance, PSX::PxHitFlag::eDEFAULT, PSX::PxQueryFlag::eDYNAMIC, m_SweepBufferGrip);
bCollision = m_pGameInstance->SphereCast(2.f, vStartPos, vDir, fDistance, PSX::PxHitFlag::eDEFAULT, PSX::PxQueryFlag::eDYNAMIC, m_SweepBufferGrip);
if (true == bCollision) {
iHitCount += m_SweepBufferGrip.getNbTouches() + m_SweepBufferGrip.hasBlock;
auto touches = m_SweepBufferGrip.getTouches();
@@ -0,0 +1,54 @@
#pragma once
#include "Client_Define.h"
#include "PartObject.h"
NS_BEGIN(Client)
class CItem_Potion final : public CPartObject
{
public:
typedef struct tagPotion : public CPartObject::PARTOBJECT_DESC
{
const _float4x4* pSocketMatrices = { };
}POTION_DESC;
private:
CItem_Potion(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CItem_Potion(const CItem_Potion& Prototype);
virtual ~CItem_Potion() = default;
public:
virtual HRESULT Initialize_Prototype() override;
virtual HRESULT Initialize(void* pArg) override;
virtual void Priority_Update(_float fTimeDelta) override;
virtual void Update(_float fTimeDelta) override;
virtual void Late_Update(_float fTimeDelta) override;
virtual HRESULT Render() override;
void Set_Attach(_bool Attach);
public:
private:
const _float4x4* m_pSocketMatrices = { };
CShader* m_pShaderCom = { nullptr };
CModel* m_pModelCom = { nullptr };
_float4x4 m_pWandTipMatrix = {};
_float3 m_Offset = {};
_bool m_bAttach = { true };
_float m_fTimer = {};
private:
HRESULT Ready_Components();
HRESULT Bind_ShaderResources();
public:
static CItem_Potion* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr)override;
virtual void Free() override;
#ifdef _DEBUG
void Describe_Entity() override;
#endif // _DEBUG
};
NS_END
@@ -2130,6 +2130,12 @@ HRESULT CLoader::Loading_For_ObjectViewer()
vector<future<pair<_wstring, CModel*>*>> futures = {};
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_SM_Bottle_EmptyCapOff_Model"),
CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM_LOCAL, "C:/MeshTable\\Game\\Cinematics\\Props\\SM_Bottle_EmptyCapOff.fbx", XMMatrixIdentity())))) {
return E_FAIL;
}
#pragma region BODY
futures.emplace_back(Deferred_ModelLoad(