Files
Hogwarts_Legacy/Jusin154_Team3D/Client/Private/DecendoSide.cpp
T
2026-01-13 22:09:08 +09:00

208 lines
4.0 KiB
C++

#include "pch.h"
#include "DecendoSide.h"
#include "GameInstance.h"
#include "EffectParts.h"
#include "Player.h"
#include "Wand.h"
#include "TrailObject.h"
CDecendoSide::CDecendoSide(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CEffect_Container{ pDevice, pContext }
{
}
CDecendoSide::CDecendoSide(const CDecendoSide& rhs)
: CEffect_Container(rhs)
{
}
HRESULT CDecendoSide::Initialize_Prototype()
{
if (FAILED(Load_Package("../Bin/Resources/Data/Effect/Package/DecendoSide")))
return E_FAIL;
return S_OK;
}
HRESULT CDecendoSide::Initialize(void* pArg)
{
if (FAILED(__super::Initialize(pArg)))
return E_FAIL;
if (FAILED(Ready_Components(pArg)))
return E_FAIL;
if (FAILED(Create_Effect()))
return E_FAIL;
m_wstrEffectName = L"DecendoSide";
m_pWandLight = Get_PartObject<CEffectParts>("Wand_Light_R");
m_pWandTrail = Get_PartObject<CTrailObject>();
m_pWand_Fire = Get_PartObject<CEffectParts>("Wand_Fire");
SAFE_ADDREF(m_pWandLight);
SAFE_ADDREF(m_pWandTrail);
SAFE_ADDREF(m_pWand_Fire);
m_fDuration = 2.f;
m_Events.emplace(0.8f, [&]() {
m_isParticleEnd = true;
m_pWandTrail->SetDissolve(true);
m_pWand_Fire->Get_Component<CTransform>()->Set_State(STATE::POSITION, XMVectorSet(0.f, -9999.f, 0.f, 1.f));
});
return S_OK;
}
void CDecendoSide::Priority_Update(_float fTimeDelta)
{
__super::Priority_Update(fTimeDelta);
}
void CDecendoSide::Update(_float fTimeDelta)
{
if (m_bVisible == false)
return;
__super::Update(fTimeDelta);
Update_Event(fTimeDelta);
CWand* pWand = static_cast<CWand*>(m_pOwner);
if (pWand == nullptr)
return;
m_pWandLight->Get_Component<CTransform>()->Set_State(STATE::POSITION, pWand->Get_WorldPostion());
if(m_isParticleEnd == false)
m_pWand_Fire->Get_Component<CTransform>()->Set_State(STATE::POSITION, pWand->Get_WorldPostion());
_matrix TrailMat = m_isTrailEnd ? XMLoadFloat4x4(&m_TrailStopMat) : pWand->Get_WorldMatrix();
m_pWandTrail->Trail_Update(TrailMat, fTimeDelta);
}
void CDecendoSide::Late_Update(_float fTimeDelta)
{
if (m_bVisible == false)
return;
__super::Late_Update(fTimeDelta);
}
HRESULT CDecendoSide::Pre_Setting(CGameObject* pObject, void* pArg)
{
if (FAILED(__super::Pre_Setting(pObject, nullptr)))
return E_FAIL;
CWand* pWand = static_cast<CWand*>(m_pOwner);
if (pWand == nullptr)
return E_FAIL;
m_isTrailEnd = false;
m_isParticleEnd = false;
m_pWandTrail->SetDissolve(false);
m_pWandLight->Set_Visible(true);
m_pWand_Fire->Set_Visible(true);
/*트레일 초기화 */
m_pWandTrail->Set_Visible(true);
m_pWandTrail->Get_Component<CTrail>()->Reset_Trail();
/*_vector pPos = pPlayer->Get_WandPos().r[3];*/
m_pWandLight->Get_Component<CTransform>()->Set_State(STATE::POSITION, pWand->Get_WorldPostion());
m_pWand_Fire->Get_Component<CTransform>()->Set_State(STATE::POSITION, pWand->Get_WorldPostion());
return S_OK;
}
HRESULT CDecendoSide::Ready_Components(void* pArg)
{
if (FAILED(__super::Ready_Components(pArg))) {
return E_FAIL;
}
return S_OK;
}
HRESULT CDecendoSide::Ready_Child()
{
return S_OK;
}
CDecendoSide* CDecendoSide::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CDecendoSide* pInstance = new CDecendoSide(pDevice, pContext);
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CDecendoSide");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
CGameObject* CDecendoSide::Clone(void* pArg, CGameObject* pOwner)
{
CDecendoSide* pInstance = new CDecendoSide(*this);
pInstance->m_pOwner = pOwner;
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CDecendoSide");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
void CDecendoSide::OnCollision(CGameObject* pOther, void* pDesc)
{
ON_COLLISION_INFO* CollisionDesc = static_cast<ON_COLLISION_INFO*>(pDesc);
}
void CDecendoSide::Free()
{
__super::Free();
Safe_Release(m_pWandLight);
Safe_Release(m_pWandTrail);
Safe_Release(m_pWand_Fire);
}
#ifdef _DEBUG
void CDecendoSide::Describe_Entity()
{
}
#endif // _DEBUG
HRESULT CDecendoSide::Bind_ShaderResources()
{
return S_OK;
}