diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 6e1de08e8..9479f2741 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -376,7 +376,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_SkyBox(const _wstring& strLayerTag) HRESULT CLevel_GamePlay::Ready_Layer_Monster() { - for (_uint i = 0; i < 5; ++i) + for (_uint i = 0; i < 1; ++i) { if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER))) { return E_FAIL; diff --git a/Jusin154_Team3D/Client/Private/Levioso.cpp b/Jusin154_Team3D/Client/Private/Levioso.cpp index 72aafa508..a2a1a4a4a 100644 --- a/Jusin154_Team3D/Client/Private/Levioso.cpp +++ b/Jusin154_Team3D/Client/Private/Levioso.cpp @@ -126,9 +126,6 @@ HRESULT CLevioso::Pre_Setting(CGameObject* pObject, void* pArg) CEffectParts* pWandLight = Get_PartObject("Levioso_Wand_Light"); - m_pLeviosoPJ_0->Get_Component()->Set_WorldMatrix(m_pOwner->Get_Component()->Get_XMWorldMatrix()); - m_pTrail_PT_0->Get_Component()->Set_WorldMatrix(m_pOwner->Get_Component()->Get_XMWorldMatrix()); - m_pLeviosoPJ_0->Get_Component()->Set_State(STATE::POSITION, WandPos); m_pTrail_PT_0->Get_Component()->Set_State(STATE::POSITION, WandPos); @@ -165,6 +162,16 @@ HRESULT CLevioso::Pre_Setting(CGameObject* pObject, void* pArg) } + _vector vDir = XMVector3Normalize(XMLoadFloat3(&m_vCameraLook)); + + _vector vRight = XMVector3Normalize(XMVector3Cross(XMVectorSet(0.f, 1.f, 0.f, 0.f), vDir)); + + _vector vUp = XMVector3Normalize(XMVector3Cross(vRight, vDir)); + + _matrix ProjMat = _matrix(vRight, vUp, vDir, vStartPos); + + m_pLeviosoPJ_0->Get_Component()->Set_WorldMatrix(ProjMat); + return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Levioso.cpp b/Jusin154_Team3D/Editor/Private/Levioso.cpp index 0a7a72f9c..a503bf238 100644 --- a/Jusin154_Team3D/Editor/Private/Levioso.cpp +++ b/Jusin154_Team3D/Editor/Private/Levioso.cpp @@ -6,6 +6,7 @@ #include "Player.h" #include "TrailObject.h" #include "Wand.h" +#include "InfoInstance.h" CLevioso::CLevioso(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -14,7 +15,8 @@ CLevioso::CLevioso(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) } CLevioso::CLevioso(const CLevioso& rhs) - : CEffect_Container(rhs) + : CEffect_Container(rhs), + m_pInfoInstance(CInfoInstance::GetInstance()) { } @@ -74,11 +76,10 @@ void CLevioso::Update(_float fTimeDelta) Update_Event(fTimeDelta); - m_pLeviosoPJ_0->Get_Component()->Translation(m_vOwnerLook * 0.25f); + m_pLeviosoPJ_0->Get_Component()->Translation(XMLoadFloat3(&m_vCameraLook) * m_fLinearSpeed); + m_pTrail_PT_0->Get_Component()->Translation(XMLoadFloat3(&m_vCameraLook) * m_fLinearSpeed); - m_pTrail_PT_0->Get_Component()->Translation(m_vOwnerLook * 0.25f); - if (true == m_pGameInstance->SphereCast(0.0f, XMLoadFloat4(&m_vStartPos), m_vOwnerLook, XMVectorGetX(XMVector3Length(m_vOwnerLook * 1.f)) , PSX::PxHitFlag::ePOSITION | PSX::PxHitFlag::eNORMAL, PSX::PxQueryFlag::eSTATIC, m_Hitbuffer)) { @@ -126,11 +127,8 @@ HRESULT CLevioso::Pre_Setting(CGameObject* pObject, void* pArg) _vector WandPos = pPlayer->Get_WandPos().r[3]; CEditEffect* pWandSmoke = Get_PartObject("Levioso_Wand0"); - CEditEffect* pWandLight= Get_PartObject("Levioso_Wand_Light"); - + CEditEffect* pWandLight = Get_PartObject("Levioso_Wand_Light"); - m_pLeviosoPJ_0->Get_Component()->Set_WorldMatrix(m_pOwner->Get_Component()->Get_XMWorldMatrix()); - m_pTrail_PT_0->Get_Component()->Set_WorldMatrix(m_pOwner->Get_Component()->Get_XMWorldMatrix()); m_pLeviosoPJ_0->Get_Component()->Set_State(STATE::POSITION, WandPos); @@ -143,11 +141,41 @@ HRESULT CLevioso::Pre_Setting(CGameObject* pObject, void* pArg) pWandSmoke->Set_Visible(true); pWandLight->Set_Visible(true); - m_pLeviosoTrail->Set_Visible(true); - m_pLeviosoTrail->Get_Component()->Reset_Trail(); m_vOwnerLook = XMVector3Normalize(m_pOwner->Get_Component()->Get_State(STATE::LOOK)); + _vector vDirection = m_pOwner->Get_Component()->Get_State(STATE::LOOK); + XMStoreFloat3(&m_vCameraLook, vDirection); + + _vector vStartPos = WandPos; + XMStoreFloat4(&m_vStartPos, vStartPos); + + { /* 대상 위치 지정 */ + + CUnit* pTargetUnit = m_pInfoInstance->Get_LockOnUnit(); + if (nullptr != pTargetUnit) { + + XMStoreFloat4(&m_vTargetPos, pTargetUnit->Get_LockOnPos()); + + XMStoreFloat3(&m_vCameraLook, XMVector3Normalize(XMLoadFloat4(&m_vTargetPos) - XMLoadFloat4(&m_vStartPos))); + } + else { + // 타겟이 없다면 현재위치 -> 카메라 룩벡터 * duration간 예상 이동거리 를 대상으로 지정 + XMStoreFloat4(&m_vTargetPos, vStartPos + vDirection * m_fLinearSpeed * 0.5f); + } + + } + + _vector vDir = XMVector3Normalize(XMLoadFloat3(&m_vCameraLook)); + + _vector vRight = XMVector3Normalize(XMVector3Cross(XMVectorSet(0.f, 1.f, 0.f, 0.f), vDir)); + + _vector vUp = XMVector3Normalize(XMVector3Cross(vRight, vDir)); + + _matrix ProjMat = _matrix(vRight, vUp, vDir, vStartPos); + + m_pLeviosoPJ_0->Get_Component()->Set_WorldMatrix(ProjMat); + return S_OK; } diff --git a/Jusin154_Team3D/Editor/Public/Levioso.h b/Jusin154_Team3D/Editor/Public/Levioso.h index 6577efc8b..8f841cc38 100644 --- a/Jusin154_Team3D/Editor/Public/Levioso.h +++ b/Jusin154_Team3D/Editor/Public/Levioso.h @@ -23,6 +23,8 @@ class CLevioso final : public CEffect_Container public: virtual HRESULT Pre_Setting(CGameObject* pObject, void* pArg = nullptr) override; +private: + class CInfoInstance* m_pInfoInstance = { nullptr }; private: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; @@ -42,6 +44,11 @@ class CLevioso final : public CEffect_Container _float m_fAccRotateTime = {}; _float m_fTurnSpeed = {}; _float m_fRange = {}; + + _float4 m_vStartPos = { 0.f, 0.f, 0.f, 1.f }; // 현재 발사 된 위치 + _float4 m_vTargetPos = { 0.f, 0.f, 10.f, 1.f }; // 현재 타게팅 된 위치 + _float m_fLinearSpeed = 0.25f; + _float3 m_vCameraLook = {}; public: static CLevioso* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual void Free() override;