diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 49dd2a365..a6bbfcca4 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -185,6 +185,7 @@ call Update_Resources.bat + @@ -366,6 +367,7 @@ call Update_Resources.bat + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 519fe9a6b..31269e643 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -532,7 +532,7 @@ 02.GameObjects\Effect\PropsEffect\Barral - + 04.Mechanic\State\Broom_Player\State_Broom_Hover @@ -554,6 +554,9 @@ 02.GameObjects\Environment\03.MapElement\Door + + 02.GameObjects\Item\Potion + @@ -1148,7 +1151,7 @@ {3103c6e1-60cb-438b-a3eb-844b919ccd43} - + {24f6903f-8f6b-46ff-a387-ecb44d673887} @@ -1170,6 +1173,9 @@ {b09f9ada-6cf4-41a4-ad28-f00855509825} + + {ace6c64f-901a-424e-99da-53f281413d77} + @@ -1646,7 +1652,7 @@ 02.GameObjects\Effect\PropsEffect\Chair - + 04.Mechanic\State\Broom_Player\State_Broom_Hover @@ -1668,6 +1674,9 @@ 02.GameObjects\Environment\03.MapElement\Door + + 02.GameObjects\Item\Potion + diff --git a/Jusin154_Team3D/Client/Private/Item_Potion.cpp b/Jusin154_Team3D/Client/Private/Item_Potion.cpp new file mode 100644 index 000000000..1609a2c54 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/Item_Potion.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 (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(&m_pModelCom)))) + return E_FAIL; + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH, + reinterpret_cast(&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 diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 995765791..8f56c753e 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -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(g_iStaticLevel, CWand::Create(m_pDevice, m_pContext)))) return E_FAIL; + /* For.Prototype_GameObject_Potion */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CItem_Potion::Create(m_pDevice, m_pContext)))) + return E_FAIL; + /* For.Prototype_GameObject_Troll_Weapon */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CTroll_Weapon::Create(m_pDevice, m_pContext)))) return E_FAIL; diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index f5dc94ce6..c0fa3dd2e 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -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("Potion", g_iStaticLevel, nullptr, &PotionDesc))) + { + return E_FAIL; + } + + Get_PartObject()->Set_Visible(false); + { CCamPosition_Shoulder::CAMERA_SHOULDER_DESC Desc; Desc.pParentTransform = m_pTransformCom; diff --git a/Jusin154_Team3D/Client/Private/Player_States.cpp b/Jusin154_Team3D/Client/Private/Player_States.cpp index 2dd4f4dd8..34b638498 100644 --- a/Jusin154_Team3D/Client/Private/Player_States.cpp +++ b/Jusin154_Team3D/Client/Private/Player_States.cpp @@ -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()->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()->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)) diff --git a/Jusin154_Team3D/Client/Private/Troll_States.cpp b/Jusin154_Team3D/Client/Private/Troll_States.cpp index 2f8fa7435..8192ce1f5 100644 --- a/Jusin154_Team3D/Client/Private/Troll_States.cpp +++ b/Jusin154_Team3D/Client/Private/Troll_States.cpp @@ -912,7 +912,7 @@ void CTroll::CheckHammerHits(_uint& iHitCount, vector& 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& 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(); diff --git a/Jusin154_Team3D/Client/Public/Item_Potion.h b/Jusin154_Team3D/Client/Public/Item_Potion.h new file mode 100644 index 000000000..983d862fd --- /dev/null +++ b/Jusin154_Team3D/Client/Public/Item_Potion.h @@ -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 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Potion/SM_Bottle_EmptyCapOff.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Potion/SM_Bottle_EmptyCapOff.bin new file mode 100644 index 000000000..3bf94078e --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/Potion/SM_Bottle_EmptyCapOff.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f1494c242f4b9eff1a15b759e0ac6d48b58c529e88c53ba59e0e58dff688607 +size 160154 diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 13fc18866..2e138f5c9 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -2130,6 +2130,12 @@ HRESULT CLoader::Loading_For_ObjectViewer() vector*>> 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(