196 lines
4.2 KiB
C++
196 lines
4.2 KiB
C++
#include "pch.h"
|
|
#include "Bombard.h"
|
|
|
|
#include "GameInstance.h"
|
|
#include "EffectParts.h"
|
|
#include "PhysXEffectHitBox.h"
|
|
|
|
|
|
CBombard::CBombard(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
|
: CEffect_Container{ pDevice, pContext }
|
|
{
|
|
}
|
|
|
|
CBombard::CBombard(const CBombard& rhs)
|
|
: CEffect_Container(rhs)
|
|
{
|
|
}
|
|
|
|
HRESULT CBombard::Initialize_Prototype()
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
HRESULT CBombard::Initialize(void* pArg)
|
|
{
|
|
if (FAILED(__super::Initialize(pArg)))
|
|
return E_FAIL;
|
|
|
|
if (FAILED(Ready_Components(pArg)))
|
|
return E_FAIL;
|
|
|
|
if (FAILED(Ready_Child()))
|
|
return E_FAIL;
|
|
|
|
if (FAILED(Load_Directory("../Bin/Resources/Data/Effect/Bombard/")))
|
|
return E_FAIL;
|
|
|
|
|
|
m_wstrEffectName = L"Bombard";
|
|
|
|
CPartObject* pShootPt = Get_PartObject<CEffectParts>("Bombard_Shoot_Pt");
|
|
m_pLight_Projectile = Get_PartObject<CEffectParts>("Bombard_Projectile");
|
|
CPartObject* pCircle0 = Get_PartObject<CEffectParts>("Bombard_Circle0");
|
|
|
|
pShootPt->Get_Component<CTransform>()->Set_State(STATE::POSITION, m_pOwner->Get_WorldPostion());
|
|
m_pLight_Projectile->Get_Component<CTransform>()->Set_State(STATE::POSITION, m_pOwner->Get_WorldPostion());
|
|
pCircle0->Get_Component<CTransform>()->Set_State(STATE::POSITION, m_pOwner->Get_WorldPostion());
|
|
|
|
pCircle0->Set_Visible(true);
|
|
pShootPt->Set_Visible(true);
|
|
m_pLight_Projectile->Set_Visible(true);
|
|
|
|
SAFE_ADDREF(m_pLight_Projectile);
|
|
m_fDuration = 2.5f;
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
void CBombard::Priority_Update(_float fTimeDelta)
|
|
{
|
|
__super::Priority_Update(fTimeDelta);
|
|
|
|
}
|
|
|
|
void CBombard::Update(_float fTimeDelta)
|
|
{
|
|
if (m_bVisible == false)
|
|
return;
|
|
|
|
__super::Update(fTimeDelta);
|
|
|
|
Update_Event(fTimeDelta);
|
|
|
|
_vector vOwnerLook = m_pOwner->Get_Component<CTransform>()->Get_State(STATE::LOOK);
|
|
|
|
m_pLight_Projectile->Get_Component<CTransform>()->Translation(vOwnerLook * 2.f);
|
|
}
|
|
|
|
void CBombard::Late_Update(_float fTimeDelta)
|
|
{
|
|
if (m_bVisible == false)
|
|
return;
|
|
|
|
__super::Late_Update(fTimeDelta);
|
|
|
|
|
|
}
|
|
|
|
HRESULT CBombard::Ready_Components(void* pArg)
|
|
{
|
|
if (FAILED(__super::Ready_Components(pArg))) {
|
|
return E_FAIL;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
HRESULT CBombard::Ready_Child()
|
|
{
|
|
CPhysXEffectHitBox::PHYSXDUMMY_DESC Desc{};
|
|
|
|
m_pTransformCom->Set_State(STATE::POSITION, m_pOwner->Get_WorldPostion());
|
|
|
|
XMStoreFloat3(&Desc.vPos, m_pOwner->Get_WorldPostion() + XMVectorSet(0.f, 0.f, 1.f, 0.f));
|
|
|
|
Desc.vRotRPY = { 0.f, 0.f, 0.f };
|
|
Desc.iSubKind = 70;
|
|
Desc.vDeltaPos = { 0.f, 0.f, 2.f };
|
|
Desc.vLifeTime = { 0.f, 2.f };
|
|
|
|
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CPhysXEffectHitBox>(g_iStaticLevel, CURRENT_LEVEL, LAYER_HITBOX, &Desc, this , &m_pPhysHitBox))) {
|
|
assert(false);
|
|
return E_FAIL;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
CBombard* CBombard::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
|
{
|
|
CBombard* pInstance = new CBombard(pDevice, pContext);
|
|
|
|
if (FAILED(pInstance->Initialize_Prototype()))
|
|
{
|
|
MSG_BOX("Failed to Created : CBombard");
|
|
SAFE_RELEASE(pInstance);
|
|
}
|
|
|
|
return pInstance;
|
|
}
|
|
|
|
|
|
CGameObject* CBombard::Clone(void* pArg, CGameObject* pOwner)
|
|
{
|
|
CBombard* pInstance = new CBombard(*this);
|
|
pInstance->m_pOwner = pOwner;
|
|
if (FAILED(pInstance->Initialize(pArg)))
|
|
{
|
|
MSG_BOX("Failed to Cloned : CBombard");
|
|
SAFE_RELEASE(pInstance);
|
|
}
|
|
|
|
return pInstance;
|
|
}
|
|
|
|
void CBombard::OnCollision(CGameObject* pOther , void* pDesc)
|
|
{
|
|
//CTransform* pOtherTransform = p
|
|
ON_COLLISION_INFO* CollisionDesc = static_cast<ON_COLLISION_INFO*>(pDesc);
|
|
|
|
for (auto& pPair : m_PartObjects)
|
|
{
|
|
pPair.second->Set_Visible(true);
|
|
pPair.second->Get_Component<CTransform>()->Set_State(STATE::POSITION, CollisionDesc->vWorldPos);
|
|
}
|
|
|
|
|
|
m_pLight_Projectile->Set_Visible(false);
|
|
Get_PartObject<CEffectParts>("Bombard_Shoot_Pt")->Set_Visible(false);
|
|
|
|
_vector vOwnerLook = m_pOwner->Get_Component<CTransform>()->Get_State(STATE::LOOK);
|
|
Get_PartObject<CEffectParts>("Bombard_Smoke")->Get_Component<CTransform>()->Translation(vOwnerLook);
|
|
|
|
Get_PartObject<CEffectParts>("Bombard_Circle0")->Set_Visible(false);
|
|
|
|
m_pPhysHitBox->Set_Dead();
|
|
}
|
|
|
|
void CBombard::Free()
|
|
{
|
|
__super::Free();
|
|
|
|
//if(m_pPhysHitBox != nullptr)
|
|
// if (m_pPhysHitBox->Get_Depth() == false)
|
|
// SAFE_RELEASE(m_pPhysHitBox);
|
|
|
|
SAFE_RELEASE(m_pLight_Projectile);
|
|
|
|
}
|
|
#ifdef _DEBUG
|
|
|
|
void CBombard::Describe_Entity()
|
|
{
|
|
|
|
}
|
|
#endif // _DEBUG
|
|
|
|
HRESULT CBombard::Bind_ShaderResources()
|
|
{
|
|
return S_OK;
|
|
}
|
|
|
|
|