From f84e48b71b139a1882254f88ee35c9d7446e3231 Mon Sep 17 00:00:00 2001 From: hyunbin14 Date: Fri, 12 Dec 2025 13:15:36 +0900 Subject: [PATCH] =?UTF-8?q?[Add]=20=EB=8F=84=EB=81=BC=20=EC=B6=A9=EB=8F=8C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Client/Private/Goblin_BattleAxe.cpp | 103 +++++++++++++++++- .../Client/Private/Level_GamePlay.cpp | 4 +- Jusin154_Team3D/Client/Private/Loader.cpp | 2 +- .../Client/Private/Player_States.cpp | 16 ++- .../Client/Public/Goblin_BattleAxe.h | 13 +++ 5 files changed, 128 insertions(+), 10 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp b/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp index f80a96b46..667ae32c3 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_BattleAxe.cpp @@ -44,6 +44,10 @@ HRESULT CGoblin_BattleAxe::Initialize(void* pArg) void CGoblin_BattleAxe::Priority_Update(_float fTimeDelta) { + if (m_bVisible) { + XMStoreFloat4(&m_vStartAxePos, Get_WorldPostion()); + XMStoreFloat4(&m_vStartGripPos, Get_WorldPostion()); + } m_pModelCom->Combined_BoneMatrix(); _matrix socketMatrix = {}; @@ -75,7 +79,13 @@ void CGoblin_BattleAxe::Update(_float fTimeDelta) void CGoblin_BattleAxe::Late_Update(_float fTimeDelta) { - m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + SwingHit(m_bPlayerHit); + } + else { + m_bPlayerHit = false; + } } HRESULT CGoblin_BattleAxe::Render() @@ -83,8 +93,10 @@ HRESULT CGoblin_BattleAxe::Render() if (!m_pModelCom) return S_OK; - if (!m_bVisible) + if (!m_bVisible) { + return S_OK; + } if (FAILED(Bind_ShaderResources())) { return E_FAIL; @@ -193,6 +205,93 @@ HRESULT CGoblin_BattleAxe::Bind_ShaderResources() return S_OK; } +void CGoblin_BattleAxe::CheckAxeHits(_uint& iHitCount, vector& pxHits) +{ + { + _vector vStartPos = XMLoadFloat4(&m_vStartAxePos); + _vector vEndPos = XMVectorSet(m_vAxeMat._41, m_vAxeMat._42, m_vAxeMat._43,1.f); + _vector vDir = vEndPos - vStartPos; + _float fDistance = XMVectorGetX(XMVector4Length(vDir)); + vDir = XMVector4Normalize(vDir); + + _bool bCollision = false; + m_SweepBufferAxe = {}; + bCollision = m_pGameInstance->SphereCast(1.2f, vStartPos, vDir, fDistance, PSX::PxHitFlag::eDEFAULT, PSX::PxQueryFlag::eDYNAMIC, m_SweepBufferAxe); + if (true == bCollision) { + iHitCount += m_SweepBufferAxe.getNbTouches() + m_SweepBufferAxe.hasBlock; + auto touches = m_SweepBufferAxe.getTouches(); + for (_uint i = 0; i < m_SweepBufferAxe.nbTouches; ++i) { + pxHits.push_back(m_SweepBufferAxe.touches[i]); + } + if (true == m_SweepBufferAxe.hasBlock) { + pxHits.push_back(m_SweepBufferAxe.block); + } + } + } + { + _vector vStartPos = XMLoadFloat4(&m_vStartGripPos); + _vector vEndPos = m_pTransformCom->Get_State(STATE::POSITION); + _vector vDir = vEndPos - vStartPos; + _float fDistance = XMVectorGetX(XMVector4Length(vDir)); + vDir = XMVector4Normalize(vDir); + + _bool bCollision = false; + m_SweepBufferGrip = {}; + bCollision = m_pGameInstance->SphereCast(1.2f, 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(); + for (_uint i = 0; i < m_SweepBufferGrip.nbTouches; ++i) { + pxHits.push_back(m_SweepBufferGrip.touches[i]); + } + if (true == m_SweepBufferGrip.hasBlock) { + pxHits.push_back(m_SweepBufferGrip.block); + } + } + } +} + + +void CGoblin_BattleAxe::SwingHit(_bool& bPlayerHit) +{ + vector pxHits; + _uint iHitCount = 0; + CheckAxeHits(iHitCount, pxHits); + { + for (_uint i = 0; i < pxHits.size(); ++i) { + PSX::PxActor* pxHitActor = pxHits[i].actor; + if (nullptr != pxHitActor && nullptr != pxHitActor->userData) { + PhsXUserData* pUserData = (PhsXUserData*)pxHitActor->userData; + switch (PXOBJECT(pUserData->iSubKind)) + { + case PXOBJECT::PLAYER: + { + if (true == bPlayerHit) { + continue; + } + CStat* pStat = pUserData->pCharacter->Get_Owner()->Get_Component(); + pStat->Get_Damage(20.f); + bPlayerHit = true; + pUserData->pOwner->OnCollision(this); + } break; + case PXOBJECT::ALLY_HITBOX: + break; + case PXOBJECT::ENVIRIONMENT: + break; + case PXOBJECT::TERRAIN: + break; + case PXOBJECT::BOX: + break; + case PXOBJECT::NPC: + break; + default: + break; + } + } + } + } +} + CGoblin_BattleAxe* CGoblin_BattleAxe::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 6d3dcfb54..3226b3dce 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -238,7 +238,7 @@ HRESULT CLevel_GamePlay::Ready_Background() isReady_Background = true; #endif // gimch #ifdef Bin - isReady_Background = false; + isReady_Background = true; #endif // #ifdef 진우 isReady_Background = true; @@ -267,7 +267,7 @@ HRESULT CLevel_GamePlay::Ready_Background() return E_FAIL; /* 조명 오브젝트 */ - /*CInfoInstance::GetInstance()->Load_LightElements("LightElement"); */ + CInfoInstance::GetInstance()->Load_LightElements("LightElement"); /* 상호작용 오브젝트 */ CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_Barrel"); diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index f472d6cd8..995765791 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -312,7 +312,7 @@ HRESULT CLoader::Loading_For_GamePlay() isLoad_Background = true; #endif // gimch #ifdef Bin - isLoad_Background = false; + isLoad_Background = true; #endif // #ifdef 진우 isLoad_Background = true; diff --git a/Jusin154_Team3D/Client/Private/Player_States.cpp b/Jusin154_Team3D/Client/Private/Player_States.cpp index d47a4daa2..2dd4f4dd8 100644 --- a/Jusin154_Team3D/Client/Private/Player_States.cpp +++ b/Jusin154_Team3D/Client/Private/Player_States.cpp @@ -989,7 +989,7 @@ void CPlayer::Behavior_LightAttackEnter() Add_Event(pairAnimInfo.first, [this]() {_uint iIndex = 0; m_pEffectPool->Use_Skill(SKILL_TYPE::JAP, Get_PartObject(), &iIndex); }, - 0.1f); + 0.07f); Add_Event(pairAnimInfo.first, [this]() { m_pEffectPool->Use_Skill(SKILL_TYPE::JAP_SIDE, Get_PartObject()); }, @@ -1016,7 +1016,13 @@ HRESULT CPlayer::Behavior_LightAttackExitCheck(_float fTimeDelta) _uint iNext = iCurr + 1; pairAnimInfo = m_Animation[STATEANIM::LIGHT_ATTACK]; pairAnimInfo.first = iNext; - + _float fAttackRatio; + if (pairAnimInfo.first - m_Animation[STATEANIM::LIGHT_ATTACK].first == 3) { + fAttackRatio = 0.12f; + } + else { + fAttackRatio = 0.07f; + } Add_Event(pairAnimInfo.first, [this]() {m_bLookAt = true; @@ -1032,7 +1038,7 @@ HRESULT CPlayer::Behavior_LightAttackExitCheck(_float fTimeDelta) _uint comboIndex = m_pModelCom->Get_AnimIndex() - m_Animation[STATEANIM::LIGHT_ATTACK].first; m_pEffectPool->Use_Skill(SKILL_TYPE::JAP, Get_PartObject(), &comboIndex); }, - 0.05f); + fAttackRatio); Add_Event(iNext, [this]() {m_pEffectPool->Use_Skill(SKILL_TYPE::JAP_SIDE,Get_PartObject()); @@ -1831,7 +1837,7 @@ void CPlayer::Behavior_Broom_DismountEnter() m_pTransformCom->Set_State(STATE::RIGHT, right); m_pTransformCom->Set_State(STATE::UP, up); m_pTransformCom->Set_State(STATE::LOOK, look); - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second,1.f,false,1.3f); + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second,1.f,false,1.6f); } HRESULT CPlayer::Behavior_Broom_DismountExitCheck(_float fTimeDelta) @@ -2310,7 +2316,7 @@ void CPlayer::Set_Anim() m_Animation[STATEANIM::SPELL_90_L] = { 826,false }; m_Animation[STATEANIM::MAPHELP] = { 122,false }; - m_Animation[STATEANIM::POTION] = { 114,false }; // 114 포션 // 909 루모스 + m_Animation[STATEANIM::POTION] = { 115,false }; // 114 포션 // 909 루모스 m_Animation[STATEANIM::ACCIO] = { 417,false }; m_Animation[STATEANIM::DESCENDO] = { 857,false }; m_Animation[STATEANIM::DEPULSO] = { 858,false }; diff --git a/Jusin154_Team3D/Client/Public/Goblin_BattleAxe.h b/Jusin154_Team3D/Client/Public/Goblin_BattleAxe.h index 4df150f5c..97263633d 100644 --- a/Jusin154_Team3D/Client/Public/Goblin_BattleAxe.h +++ b/Jusin154_Team3D/Client/Public/Goblin_BattleAxe.h @@ -35,6 +35,15 @@ class CGoblin_BattleAxe final : public CPartObject _float4x4 m_vAxeMat= {}; + + PSX::PxSweepBufferN<12> m_SweepBufferAxe = {}; + PSX::PxSweepBufferN<12> m_SweepBufferGrip = {}; + const _float4* m_pAxePos = { nullptr }; + const _float4* m_pAxeGripPos = { nullptr }; + _float4 m_vStartAxePos = { }; + _float4 m_vStartGripPos = { }; + _bool m_bPlayerHit = {}; + #ifdef _DEBUG unique_ptr m_pGripShape = { nullptr }; unique_ptr m_pSubShape = { nullptr }; @@ -45,6 +54,10 @@ class CGoblin_BattleAxe final : public CPartObject HRESULT Ready_Components(); HRESULT Bind_ShaderResources(); + void CheckAxeHits(_uint& iHitCount, vector& pxHits); + + void SwingHit(_bool& bPlayerHit); + public: static CGoblin_BattleAxe* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr)override;