diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj
index 9d4ab8cb3..4434b380e 100644
--- a/Jusin154_Team3D/Client/Default/Client.vcxproj
+++ b/Jusin154_Team3D/Client/Default/Client.vcxproj
@@ -171,6 +171,7 @@ call Update_Resources.bat
+
@@ -472,6 +473,7 @@ call Update_Resources.bat
+
diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters
index e970fcc8c..cc3e7cec6 100644
--- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters
+++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters
@@ -924,6 +924,9 @@
02.GameObjects\NPC\Hostile\Monster\Ranrok
+
+ 02.GameObjects\UI\GamePlay_Canvas\Broom_Panel\Broom_TargetGate2D
+
@@ -1909,6 +1912,9 @@
{c0fdb122-503b-47f0-a544-90d153464c9a}
+
+ {4a11eb4b-127e-41f2-8456-cae963c94a4c}
+
@@ -2780,6 +2786,9 @@
04.Mechanic\State\State_Combat\State_Block
+
+ 02.GameObjects\UI\GamePlay_Canvas\Broom_Panel\Broom_TargetGate2D
+
diff --git a/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp b/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp
index 092301222..9ab159e5f 100644
--- a/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp
+++ b/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp
@@ -44,43 +44,43 @@ void CBroomRaceManager::Priority_Update(_float fTimeDelta)
{
__super::Priority_Update(fTimeDelta);
- switch (m_eRaceState)
+ switch (m_eRaceState)
+ {
+ case ENUM_CLASS(RACE_STATE::COUNTDOWN):
+ Update_Countdown(fTimeDelta);
+ break;
+ case ENUM_CLASS(RACE_STATE::RACING):
+ Check_RingPassed();
+ break;
+ case ENUM_CLASS(RACE_STATE::FINISH):
+ break;
+ case ENUM_CLASS(RACE_STATE::END):
+ {
+ if (m_bCurrentRace == true)
{
- case ENUM_CLASS(RACE_STATE::COUNTDOWN):
- Update_Countdown(fTimeDelta);
- break;
- case ENUM_CLASS(RACE_STATE::RACING):
- Check_RingPassed();
- break;
- case ENUM_CLASS(RACE_STATE::FINISH):
- break;
- case ENUM_CLASS(RACE_STATE::END):
- {
- if (m_bCurrentRace == true)
+ if (m_pGameInstance->Key_Down(DIK_ESCAPE))
{
- if (m_pGameInstance->Key_Down(DIK_ESCAPE))
- {
- m_bRaceEnd = true;
- _float Alpha = 2.f;
- m_pInfoInstance->Event_CallBack(TEXT("UIFadeIn"), &Alpha);
- }
-
- for (auto& racer : m_Racers)
- {
- if (racer.pAI)
- {
- racer.pAI->Get_Broom()->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f));
- }
- if (racer.pRacer)
- {
-
- }
- }
+ m_bRaceEnd = true;
+ _float Alpha = 2.f;
+ m_pInfoInstance->Event_CallBack(TEXT("UIFadeIn"), &Alpha);
}
+ for (auto& racer : m_Racers)
+ {
+ if (racer.pAI)
+ {
+ racer.pAI->Get_Broom()->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f));
+ }
+ if (racer.pRacer)
+ {
+
+ }
+ }
}
- break;
- }
+
+ }
+ break;
+ }
}
@@ -122,7 +122,7 @@ void CBroomRaceManager::Update(_float fTimeDelta)
}
}
- if (m_bRaceEnd)
+ if (m_bRaceEnd)
{
m_fDelay += fTimeDelta;
for (auto& racer : m_Racers) {
@@ -350,8 +350,6 @@ void CBroomRaceManager::Finish()
void CBroomRaceManager::RaceReady()
{
- //if (GUI::Button("Race Start"))
-//{
m_bCurrentRace = true;
m_eRaceState = ENUM_CLASS(RACE_STATE::READY);
const _float SPAWN_DISTANCE = 30.f;
@@ -413,15 +411,6 @@ void CBroomRaceManager::RaceReady()
}
m_bRaceReady = true;
- //}
- //if (m_eRaceState == ENUM_CLASS(RACE_STATE::READY))
- //{
- // /*if (GUI::Button("Countdown"))
- // {*/
- // m_pInfoInstance->Event_CallBack(TEXT("Ready_Race"));
- // m_eRaceState = ENUM_CLASS(RACE_STATE::COUNTDOWN);
- // //}
- //}
}
void CBroomRaceManager::SetTargetRing(CGameObject* pRacer)
@@ -491,32 +480,31 @@ HRESULT CBroomRaceManager::Load_RaceRing()
return S_OK;
}
- //for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object"))
- //{
- auto* Object = root->FirstChildElement("Object");
- CRaceRing::RACERING_DESC Desc = {};
+ for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object"))
+ {
+ CRaceRing::RACERING_DESC Desc = {};
- Desc.pBroomRaceManager = this;
+ Desc.pBroomRaceManager = this;
- /* Transform */
- auto* Rotation = Object->FirstChildElement("Scale");
- Rotation->QueryFloatAttribute("x", &Desc.vScale.x);
- Rotation->QueryFloatAttribute("y", &Desc.vScale.y);
- Rotation->QueryFloatAttribute("z", &Desc.vScale.z);
+ /* Transform */
+ auto* Rotation = Object->FirstChildElement("Scale");
+ Rotation->QueryFloatAttribute("x", &Desc.vScale.x);
+ Rotation->QueryFloatAttribute("y", &Desc.vScale.y);
+ Rotation->QueryFloatAttribute("z", &Desc.vScale.z);
- auto* Scale = Object->FirstChildElement("Rotation");
- Scale->QueryFloatAttribute("x", &Desc.vRotation.x);
- Scale->QueryFloatAttribute("y", &Desc.vRotation.y);
- Scale->QueryFloatAttribute("z", &Desc.vRotation.z);
+ auto* Scale = Object->FirstChildElement("Rotation");
+ Scale->QueryFloatAttribute("x", &Desc.vRotation.x);
+ Scale->QueryFloatAttribute("y", &Desc.vRotation.y);
+ Scale->QueryFloatAttribute("z", &Desc.vRotation.z);
- auto* Position = Object->FirstChildElement("Position");
- Position->QueryFloatAttribute("x", &Desc.vPosition.x);
- Position->QueryFloatAttribute("y", &Desc.vPosition.y);
- Position->QueryFloatAttribute("z", &Desc.vPosition.z);
+ auto* Position = Object->FirstChildElement("Position");
+ Position->QueryFloatAttribute("x", &Desc.vPosition.x);
+ Position->QueryFloatAttribute("y", &Desc.vPosition.y);
+ Position->QueryFloatAttribute("z", &Desc.vPosition.z);
- if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_RING, &Desc)))
- return E_FAIL;
- //}
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_RING, &Desc)))
+ return E_FAIL;
+ }
return S_OK;
diff --git a/Jusin154_Team3D/Client/Private/Broom_Panel.cpp b/Jusin154_Team3D/Client/Private/Broom_Panel.cpp
index 18370b3da..a5f792dd4 100644
--- a/Jusin154_Team3D/Client/Private/Broom_Panel.cpp
+++ b/Jusin154_Team3D/Client/Private/Broom_Panel.cpp
@@ -8,6 +8,7 @@
#include "Broom_Record.h"
#include "Broom_Exit.h"
#include "Broom_Trophy.h"
+#include "Broom_TargetGate2D.h"
#include "InfoInstance.h"
CBroom_Panel::CBroom_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
@@ -55,6 +56,7 @@ HRESULT CBroom_Panel::Initialize(void* pArg)
m_pInfoInstance->Add_Event(TEXT("Race_Count"), [this](void* p) {this->Race_Count(*reinterpret_cast<_int*>(p)); });
m_pInfoInstance->Add_Event(TEXT("Race_Start"), [this](void* p) {this->Race_Start(*reinterpret_cast<_int*>(p)); });
m_pInfoInstance->Add_Event(TEXT("RaceEnd"), [this](void* p) {this->Race_End(); });
+ m_pInfoInstance->Add_Event(TEXT("BroomTargetGate"), [this](void* p) {this->Set_TargetPosition(*reinterpret_cast<_vector*>(p)); });
Visible(false);
ElementAllVisible(false);
@@ -99,6 +101,18 @@ void CBroom_Panel::Update(_float fTimeDelta)
}
}
+
+ if (m_bRaceBattle == true)
+ {
+ _bool Screen = World_to_ScreenUI(m_fTargetPos, m_fUIScreenPos, 130.f);
+ static_cast(m_pBroom_TargetGate2D)->Visible(Screen);
+
+ if (Screen == true)
+ {
+ static_cast(m_pBroom_TargetGate2D)->Move(m_fUIScreenPos.x, m_fUIScreenPos.y);
+ }
+ }
+
__super::Update(fTimeDelta);
}
@@ -184,6 +198,12 @@ HRESULT CBroom_Panel::Ready_Element(void* pArg)
}
Add_Element(TEXT("Broom_Trophy"), m_pBroom_Trophy);
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, g_iStaticLevel, LAYER_UI, nullptr, this, reinterpret_cast (&m_pBroom_TargetGate2D))))
+ {
+ return E_FAIL;
+ }
+ Add_Element(TEXT("Broom_TargetGate2D"), m_pBroom_TargetGate2D);
+
return S_OK;
}
@@ -212,6 +232,8 @@ void CBroom_Panel::Race_Start(_int iRing)
static_cast(m_pBroom_Flag)->Set_Hover(true);
static_cast(m_pBroom_Scoreboard)->Visible(true);
static_cast(m_pBroom_Scoreboard)->Set_MaxRing(iRing);
+ static_cast(m_pBroom_TargetGate2D)->Visible(true);
+ m_bRaceBattle = true;
}
void CBroom_Panel::Current_Ring()
@@ -226,6 +248,7 @@ void CBroom_Panel::Race_End()
static_cast(m_pBroom_Finish)->Finish(m_fRaceTime);
static_cast(m_pBroom_Record)->Finish(m_fRaceTime);
m_bDinish = true;
+ m_bRaceBattle = false;
}
void CBroom_Panel::Race_Results()
@@ -238,6 +261,11 @@ void CBroom_Panel::Race_Results()
static_cast(m_pBroom_Trophy)->Score(static_cast(m_pBroom_Record)->NewScore());
}
+void CBroom_Panel::Set_TargetPosition(_fvector Target)
+{
+ XMStoreFloat3(&m_fTargetPos, Target);
+}
+
void CBroom_Panel::Set_BroomTimer()
{
m_fRaceTime = m_pInfoInstance->Get_Broom_Timer();
diff --git a/Jusin154_Team3D/Client/Private/Broom_TargetGate.cpp b/Jusin154_Team3D/Client/Private/Broom_TargetGate.cpp
index 474cab4dd..7da3b3c88 100644
--- a/Jusin154_Team3D/Client/Private/Broom_TargetGate.cpp
+++ b/Jusin154_Team3D/Client/Private/Broom_TargetGate.cpp
@@ -49,7 +49,7 @@ void CBroom_TargetGate::Update(_float fTimeDelta)
if (m_bVisible != true)
return;
- m_fSize = _float3(45.f, 45.f, 1.f);
+ m_fSize = _float3(70.f, 70.f, 1.f);
m_vPlayerPos = m_pInfoInstance->Get_PalyerPos();
if (m_vActive == true)
diff --git a/Jusin154_Team3D/Client/Private/Broom_TargetGate2D.cpp b/Jusin154_Team3D/Client/Private/Broom_TargetGate2D.cpp
new file mode 100644
index 000000000..603421d06
--- /dev/null
+++ b/Jusin154_Team3D/Client/Private/Broom_TargetGate2D.cpp
@@ -0,0 +1,223 @@
+#include "pch.h"
+#include "Broom_TargetGate2D.h"
+#include "GameInstance.h"
+
+CBroom_TargetGate2D::CBroom_TargetGate2D(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
+ :CElementObject(pDevice, pContext)
+{
+}
+
+CBroom_TargetGate2D::CBroom_TargetGate2D(const CBroom_TargetGate2D& rhs)
+ :CElementObject(rhs)
+{
+}
+
+HRESULT CBroom_TargetGate2D::Initialize_Prototype()
+{
+ return S_OK;
+}
+
+HRESULT CBroom_TargetGate2D::Initialize(void* pArg)
+{
+ CUIObject::UIOBJECT_DESC Desc{};
+
+ Desc.fX = 0.f;
+ Desc.fY = -140.f;
+ Desc.fSizeX = 70.f;
+ Desc.fSizeY = 70.f;
+
+ m_pRect = { long(Desc.fX - Desc.fSizeX * 0.5f), long(Desc.fY - Desc.fSizeY * 0.5f), long(Desc.fX + Desc.fSizeX * 0.5f), long(Desc.fY + Desc.fSizeY * 0.5f) };
+
+ if (FAILED(__super::Initialize(&Desc)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(Ready_Components(pArg)))
+ {
+ return E_FAIL;
+ }
+
+ m_fTimeMult = 3.f;
+ m_fAlpha = 1.f;
+ m_fAlphaTime = 10.f;
+ return S_OK;
+}
+
+void CBroom_TargetGate2D::Priority_Update(_float fTimeDelta)
+{
+ if (!__super::Chack_Visible())
+ {
+ return;
+ }
+ __super::Priority_Update(fTimeDelta);
+}
+
+void CBroom_TargetGate2D::Update(_float fTimeDelta)
+{
+ if (!__super::Chack_Visible())
+ {
+ return;
+ }
+
+ if (m_bFadeIn == true)
+ {
+ if (m_fAlpha <= 1.f)
+ m_fAlpha += fTimeDelta * m_fAlphaTime;
+
+ if (m_fAlpha >= 1.f)
+ {
+ m_bFadeIn = false;
+ m_fAlpha = 1.f;
+ }
+ }
+
+ if (m_bFadeOut == true)
+ {
+ if (m_fAlpha >= 0.f)
+ m_fAlpha -= fTimeDelta;
+
+ if (m_fAlpha <= 0.f)
+ {
+ m_bFadeOut = false;
+ m_fAlpha = 0.f;
+ }
+ }
+
+ m_fTime += fTimeDelta * m_fTimeMult;
+
+ __super::Update(fTimeDelta);
+}
+
+void CBroom_TargetGate2D::Late_Update(_float fTimeDelta)
+{
+ if (!__super::Chack_Visible())
+ {
+ return;
+ }
+ if (m_bVisible) {
+ m_pGameInstance->Add_RenderGroup(RENDER::UI_OVERLAY, this);
+ __super::Late_Update(fTimeDelta);
+ }
+}
+
+HRESULT CBroom_TargetGate2D::Render()
+{
+ if (FAILED(Bind_ShaderResources())) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::DEFAULT)))) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pVIBufferCom->Bind_Resources())) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pVIBufferCom->Render())) {
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+
+_vector CBroom_TargetGate2D::Get_WorldPostion()
+{
+ return m_pTransformCom->Get_State(STATE::POSITION);
+}
+
+HRESULT CBroom_TargetGate2D::Bind_ShaderResources()
+{
+ if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix")))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pDiffuse_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_Texture", 0)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float))))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fTime", &m_fTime, sizeof(_float))))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fAlpha", &m_fAlpha, sizeof(_float))))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fOwnerAlpha", &m_fOwnerAlpha, sizeof(_float))))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fCanvasAlpha", &m_fCanvasAlpha, sizeof(_float))))
+ {
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+HRESULT CBroom_TargetGate2D::Ready_Components(void* pArg)
+{
+ if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_UI_T_Map_RaceGate"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr)))
+ {
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+CBroom_TargetGate2D* CBroom_TargetGate2D::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
+{
+ CBroom_TargetGate2D* pInstance = new CBroom_TargetGate2D(pDevice, pContext);
+
+ if (FAILED(pInstance->Initialize_Prototype()))
+ {
+ MSG_BOX("Failed to Created : CBroom_TargetGate2D");
+ SAFE_RELEASE(pInstance);
+ }
+
+ return pInstance;
+}
+
+CGameObject* CBroom_TargetGate2D::Clone(void* pArg, CGameObject* pOwner)
+{
+ CBroom_TargetGate2D* pInstance = new CBroom_TargetGate2D(*this);
+ pInstance->m_pOwner = pOwner;
+ if (FAILED(pInstance->Initialize(pArg)))
+ {
+ MSG_BOX("Failed to Cloned : CBroom_TargetGate2D");
+ SAFE_RELEASE(pInstance);
+ }
+
+ return pInstance;
+}
+
+void CBroom_TargetGate2D::Free()
+{
+ __super::Free();
+
+ SAFE_RELEASE(m_pDiffuse_TextureCom);
+ SAFE_RELEASE(m_pShaderCom);
+ SAFE_RELEASE(m_pVIBufferCom);
+}
+
+#ifdef _DEBUG
+void CBroom_TargetGate2D::Describe_Entity()
+{
+}
+#endif // _DEBUG
diff --git a/Jusin154_Team3D/Client/Private/Dialogue_Font.cpp b/Jusin154_Team3D/Client/Private/Dialogue_Font.cpp
index 0d7c88e39..4cd141927 100644
--- a/Jusin154_Team3D/Client/Private/Dialogue_Font.cpp
+++ b/Jusin154_Team3D/Client/Private/Dialogue_Font.cpp
@@ -108,8 +108,7 @@ void CDialogue_Font::Update(_float fTimeDelta)
m_fTime = 0.5f;
NextText();
break;
- case
- ENUM_CLASS(NPCTEXTTYPE::CHOICE):
+ case ENUM_CLASS(NPCTEXTTYPE::CHOICE):
m_fTime = 0.5f;
CHoice();
break;
@@ -334,6 +333,7 @@ void CDialogue_Font::ReSet()
m_DialoguInfo.push_back((*it));
it = m_pCurrentDialogue.erase(it);
}
+ m_pInfoInstance->Event_CallBack(TEXT("NpcInteraction"), &m_bChoiceText);
}
void CDialogue_Font::NextText()
diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp
index 8042d5c91..c50946c62 100644
--- a/Jusin154_Team3D/Client/Private/Loader.cpp
+++ b/Jusin154_Team3D/Client/Private/Loader.cpp
@@ -151,6 +151,7 @@
#include "Broom_Record.h"
#include "Broom_Exit.h"
#include "Broom_Trophy.h"
+#include "Broom_TargetGate2D.h"
#include "Ride_Panel.h"
#include "Ride_Info_Key.h"
@@ -3136,6 +3137,11 @@ HRESULT CLoader::Loading_For_GamePlay()
{
return E_FAIL;
}
+ /* For.Prototype_GameObject_SpellLearn_Broom_TargetGate2D*/
+ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBroom_TargetGate2D::Create(m_pDevice, m_pContext))))
+ {
+ return E_FAIL;
+ }
/* For.Prototype_GameObject_SpellLearn_Ride_Panel*/
if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CRide_Panel::Create(m_pDevice, m_pContext))))
diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp
index 9c821a09e..6555421a4 100644
--- a/Jusin154_Team3D/Client/Private/Player.cpp
+++ b/Jusin154_Team3D/Client/Private/Player.cpp
@@ -117,6 +117,7 @@ HRESULT CPlayer::Initialize(void* pArg)
// UI 연동 추가
m_pInfoInstance->Add_Event(TEXT("UseSpell"), [this](void* p) {this->Get_Spell(*reinterpret_cast<_int*>(p)); });
m_pInfoInstance->Add_Event(TEXT("Player_CanvasChange"), [this](void* p) {this->Get_UIState(*reinterpret_cast<_int*>(p)); });
+ m_pInfoInstance->Add_Event(TEXT("NpcInteraction"), [this](void* p) {this->Set_Interaction(*reinterpret_cast<_bool*>(p)); });
m_bAI = false;
@@ -168,6 +169,7 @@ void CPlayer::Update(_float fTimeDelta)
{
if (m_bNpcInteraction == true)
{
+ m_bCurrentInteraction = true;
m_pInfoInstance->Event_CallBack(TEXT("NpcInteract"), &m_bNpcInteraction);
}
}
@@ -367,7 +369,7 @@ HRESULT CPlayer::Update_RaycastElements()
else
{
- if (m_pCurrentNpcInteraction)
+ if (m_pCurrentNpcInteraction && !m_bCurrentInteraction)
{
m_bNpcInteraction = false;
m_pCurrentNpcInteraction = nullptr;
@@ -378,7 +380,7 @@ HRESULT CPlayer::Update_RaycastElements()
else
{
- if (m_pCurrentNpcInteraction)
+ if (m_pCurrentNpcInteraction && !m_bCurrentInteraction)
{
m_bNpcInteraction = false;
m_pCurrentNpcInteraction = nullptr;
@@ -388,6 +390,11 @@ HRESULT CPlayer::Update_RaycastElements()
return S_OK;
}
+void CPlayer::Set_Interaction(_bool bInteraction)
+{
+ m_bCurrentInteraction = bInteraction;
+}
+
HRESULT CPlayer::Render_Shadow(SHADOW eType)
{
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) {
diff --git a/Jusin154_Team3D/Client/Private/RaceRing.cpp b/Jusin154_Team3D/Client/Private/RaceRing.cpp
index bc7828b29..877fd0186 100644
--- a/Jusin154_Team3D/Client/Private/RaceRing.cpp
+++ b/Jusin154_Team3D/Client/Private/RaceRing.cpp
@@ -30,7 +30,7 @@ HRESULT CRaceRing::Initialize(void* pArg)
return E_FAIL;
}
-
+
//m_iIndex = static_cast(pArg)->iIndex;
//_float X = m_pGameInstance->Real_Random_Float(-200.f, 200.f);
//_float Y = m_pGameInstance->Real_Random_Float(15.f, 60.f);
@@ -59,6 +59,8 @@ void CRaceRing::Priority_Update(_float fTimeDelta)
void CRaceRing::Update(_float fTimeDelta)
{
m_pModelCom->Combined_BoneMatrix();
+
+ World_to_ScreenUI();
}
void CRaceRing::Late_Update(_float fTimeDelta)
@@ -99,6 +101,97 @@ HRESULT CRaceRing::Render()
return S_OK;
}
+_bool CRaceRing::World_Screen(_float3 fWorld_Pos, _float2& fScreenPos, _float& fDepth)
+{
+ _matrix mView = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW);
+ _matrix mProj = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ);
+ _matrix mVP = mView * mProj;
+
+ _vector Pos = XMVectorSet(fWorld_Pos.x, fWorld_Pos.y, fWorld_Pos.z, 1.f);
+ Pos = XMVector4Transform(Pos, mVP);
+
+ _float w = XMVectorGetW(Pos);
+
+ _bool bBehind = (w <= 0.f);
+
+ _float NDCX = XMVectorGetX(Pos) / w;
+ _float NDCY = XMVectorGetY(Pos) / w;
+ _float NDCZ = XMVectorGetZ(Pos) / w;
+
+ if (bBehind)
+ {
+ fScreenPos.x = g_iWinSizeX * 0.5f; // 중앙
+ fScreenPos.y = g_iWinSizeY + 100.f; // 화면 아래
+ fDepth = -1.f;
+ return true;
+ }
+
+ fDepth = NDCZ;
+
+ fScreenPos.x = (NDCX + 1.f) * 0.5f * g_iWinSizeX;
+ fScreenPos.y = (1.f - NDCY) * 0.5f * g_iWinSizeY;
+
+ return true;
+}
+
+_bool CRaceRing::Screen(_float2& fWorld_Pos, _float Winx, _float Winy)
+{
+ return fWorld_Pos.x >= 0 && fWorld_Pos.x <= Winx &&
+ fWorld_Pos.y >= 0 && fWorld_Pos.y <= Winy;
+}
+
+_float2 CRaceRing::Get_EdgePosition(_float2& fWorld_Pos, _float Winx, _float Winy)
+{
+ _float2 center = _float2(Winx * 0.5f, Winy * 0.5f);
+ _float2 dir = _float2(fWorld_Pos.x - center.x, fWorld_Pos.y - center.y);
+
+ _float tX = FLT_MAX;
+ _float tY = FLT_MAX;
+
+ if (dir.x != 0.f)
+ {
+ tX = (dir.x > 0) ? (Winx - center.x) / dir.x : (0.f - center.x) / dir.x;
+ }
+
+ if (dir.y != 0.f)
+ {
+ tY = (dir.y > 0) ? (Winy - center.y) / dir.y : (0.f - center.y) / dir.y;
+ }
+
+ float t = min(tX, tY);
+
+ return _float2(center.x + dir.x * t, center.y + dir.y * t);
+}
+
+void CRaceRing::World_to_ScreenUI()
+{
+ _float2 fScreenPos{};
+ _float fDepth{};
+ _float3 WorldPos{};
+
+ XMStoreFloat3(&WorldPos, m_pTransformCom->Get_State(STATE::POSITION));
+
+ if (!World_Screen(WorldPos, fScreenPos, fDepth))
+ {
+ return;
+ }
+
+ _float fWinSizeX = static_cast<_float>(g_iWinSizeX);
+ _float fWinSizeY = static_cast<_float>(g_iWinSizeY);
+
+ if (!Screen(fScreenPos, fWinSizeX, fWinSizeY))
+ {
+ fScreenPos = Get_EdgePosition(fScreenPos, fWinSizeX, fWinSizeY);
+ m_bShowOffScreenUI = true;
+ }
+ else
+ {
+ m_bShowOffScreenUI = false;
+ }
+
+ m_fScreenPos = fScreenPos;
+}
+
HRESULT CRaceRing::Ready_Components()
{
__super::Ready_Components(nullptr);
diff --git a/Jusin154_Team3D/Client/Private/UI_Manager.cpp b/Jusin154_Team3D/Client/Private/UI_Manager.cpp
index 17c0fe90e..9cde886a1 100644
--- a/Jusin154_Team3D/Client/Private/UI_Manager.cpp
+++ b/Jusin154_Team3D/Client/Private/UI_Manager.cpp
@@ -15,6 +15,8 @@
#include "NPCInteraction.h"
#include "Broom_TargetGate.h"
+
+
CUI_Manager::CUI_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
:CUIObject(pDevice, pContext)
{
@@ -506,7 +508,6 @@ void CUI_Manager::Set_Fade()
void CUI_Manager::Change_Map()
{
-
}
void CUI_Manager::Set_Race(_bool bRace)
diff --git a/Jusin154_Team3D/Client/Public/Broom_Panel.h b/Jusin154_Team3D/Client/Public/Broom_Panel.h
index 83592f8fb..6e5d9a18e 100644
--- a/Jusin154_Team3D/Client/Public/Broom_Panel.h
+++ b/Jusin154_Team3D/Client/Public/Broom_Panel.h
@@ -37,6 +37,7 @@ class CBroom_Panel final : public CPanelObject
void Current_Ring();
void Race_End();
void Race_Results();
+ void Set_TargetPosition(_fvector Target);
public:
void Set_BroomTimer();
@@ -54,12 +55,16 @@ class CBroom_Panel final : public CPanelObject
CGameObject* m_pBroom_Record = { nullptr };
CGameObject* m_pBroom_Exit = { nullptr };
CGameObject* m_pBroom_Trophy = { nullptr };
+ CGameObject* m_pBroom_TargetGate2D = { nullptr };
_float m_fRaceTime{};
+ _bool m_bRaceBattle = { false };
_bool m_bDinish = { false };
_bool m_bResults = { false };
-
+ _bool m_bGateUI = { false };
+ _float2 m_fUIScreenPos{};
+ _float3 m_fTargetPos{};
public:
static CBroom_Panel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
diff --git a/Jusin154_Team3D/Client/Public/Broom_TargetGate2D.h b/Jusin154_Team3D/Client/Public/Broom_TargetGate2D.h
new file mode 100644
index 000000000..1ae02a764
--- /dev/null
+++ b/Jusin154_Team3D/Client/Public/Broom_TargetGate2D.h
@@ -0,0 +1,48 @@
+#pragma once
+
+#include "Client_Define.h"
+#include "ElementObject.h"
+
+NS_BEGIN(Engine)
+class CTexture;
+class CShader;
+class CVIBuffer_Rect;
+NS_END
+
+NS_BEGIN(Client)
+
+class CBroom_TargetGate2D final : public CElementObject
+{
+private:
+ CBroom_TargetGate2D(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
+ CBroom_TargetGate2D(const CBroom_TargetGate2D& rhs);
+ virtual ~CBroom_TargetGate2D() = default;
+
+public:
+ virtual void Priority_Update(_float fTimeDelta);
+ virtual void Update(_float fTimeDelta);
+ virtual void Late_Update(_float fTimeDelta);
+ virtual HRESULT Render() override;
+ virtual _vector Get_WorldPostion() override;
+
+private:
+ virtual HRESULT Bind_ShaderResources() override;
+ virtual HRESULT Ready_Components(void* pArg) override;
+ virtual HRESULT Initialize_Prototype() override;
+ virtual HRESULT Initialize(void* pArg) override;
+
+private:
+ CTexture* m_pDiffuse_TextureCom = { nullptr };
+ CShader* m_pShaderCom = { nullptr };
+ CVIBuffer_Rect* m_pVIBufferCom = { nullptr };
+
+public:
+ static CBroom_TargetGate2D* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
+ virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
+ virtual void Free() override;
+#ifdef _DEBUG
+ void Describe_Entity() override;
+#endif // _DEBUG
+};
+
+NS_END
diff --git a/Jusin154_Team3D/Client/Public/Player.h b/Jusin154_Team3D/Client/Public/Player.h
index aed56c4aa..6e1f767e6 100644
--- a/Jusin154_Team3D/Client/Public/Player.h
+++ b/Jusin154_Team3D/Client/Public/Player.h
@@ -42,6 +42,7 @@ class CPlayer final : public CUnit
void UpdateGrapInteractive(_float fTimeDelta);
void Update_CameraShake(_float fTimeDelta);
HRESULT Update_RaycastElements();
+ void Set_Interaction(_bool bInteraction);
#ifdef _DEBUG
void Render_CameraCoordinateSystem();
#endif // _DEBUG
@@ -58,6 +59,7 @@ class CPlayer final : public CUnit
_bool m_bCameraShake = { false };
_bool m_bNpcInteraction = { false };
+ _bool m_bCurrentInteraction = { false };
_float3 m_vCameraLookDir = { 0.f, 0.f, 1.f, };
_float3 m_vCameraRightDir = { 1.f, 0.f, 0.f };
diff --git a/Jusin154_Team3D/Client/Public/RaceRing.h b/Jusin154_Team3D/Client/Public/RaceRing.h
index 947cb43ff..8bc69c598 100644
--- a/Jusin154_Team3D/Client/Public/RaceRing.h
+++ b/Jusin154_Team3D/Client/Public/RaceRing.h
@@ -29,6 +29,12 @@ class CRaceRing final : public CGameObject
virtual HRESULT Render() override;
void Set_Target(_bool bTarget){ m_bTarget = bTarget; }
+private:
+ _bool World_Screen(_float3 fWorld_Pos, _float2& fScreenPos, _float& fDepth);
+ _bool Screen(_float2& fWorld_Pos, _float Winx, _float Winy);
+ _float2 Get_EdgePosition(_float2& fWorld_Pos, _float Winx, _float Winy);
+ void World_to_ScreenUI();
+
private:
class CBroomRaceManager* m_pBroomRaceManager = { nullptr };
CShader* m_pShaderCom = { nullptr };
@@ -36,6 +42,8 @@ class CRaceRing final : public CGameObject
_bool m_bTarget = { false };
_int m_iIndex = {};
+ _bool m_bShowOffScreenUI = { false };
+ _float2 m_fScreenPos{};
private:
HRESULT Ready_Components();
HRESULT Bind_ShaderResources();
diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj
index 2b4ed975e..5ec72311c 100644
--- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj
+++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj
@@ -185,6 +185,7 @@ call Update_Shaders.bat
+
@@ -468,6 +469,7 @@ call Update_Shaders.bat
+
diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters
index ca3a9b068..9be79f87a 100644
--- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters
+++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters
@@ -784,6 +784,9 @@
{b8e8e46c-ec9f-4a89-a970-c9de2ac3f521}
+
+ {bde6e952-c6ee-4136-8559-99392c01645e}
+
@@ -1587,6 +1590,9 @@
02.GameObjects\Layer_Effect\Effect_Editor\Effect\Magic\08.Protego\Protego_Hit
+
+ 50.UI\GamePlay_Canvas\Broom_Panel\Broom_TargetGate2D
+
@@ -2398,6 +2404,9 @@
02.GameObjects\Layer_Effect\Effect_Editor\Effect\Magic\08.Protego\Protego_Hit
+
+ 50.UI\GamePlay_Canvas\Broom_Panel\Broom_TargetGate2D
+
diff --git a/Jusin154_Team3D/Editor/Private/Broom_Panel.cpp b/Jusin154_Team3D/Editor/Private/Broom_Panel.cpp
index ce72872dd..8caae2e68 100644
--- a/Jusin154_Team3D/Editor/Private/Broom_Panel.cpp
+++ b/Jusin154_Team3D/Editor/Private/Broom_Panel.cpp
@@ -8,6 +8,7 @@
#include "Broom_Record.h"
#include "Broom_Exit.h"
#include "broom_Trophy.h"
+#include "Broom_TargetGate2D.h"
CBroom_Panel::CBroom_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
@@ -49,7 +50,7 @@ HRESULT CBroom_Panel::Initialize(void* pArg)
return E_FAIL;
}
- Visible(false);
+ Visible(true);
ElementAllVisible(true);
return S_OK;
}
@@ -154,6 +155,12 @@ HRESULT CBroom_Panel::Ready_Element(void* pArg)
return E_FAIL;
}
Add_Element(TEXT("Broom_Trophy"), m_pBroom_Trophy);
+
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast (&m_pBroom_TargetGate2D))))
+ {
+ return E_FAIL;
+ }
+ Add_Element(TEXT("Broom_TargetGate2D"), m_pBroom_TargetGate2D);
return S_OK;
}
diff --git a/Jusin154_Team3D/Editor/Private/Broom_TargetGate2D.cpp b/Jusin154_Team3D/Editor/Private/Broom_TargetGate2D.cpp
new file mode 100644
index 000000000..2bba4f634
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Private/Broom_TargetGate2D.cpp
@@ -0,0 +1,221 @@
+#include "pch.h"
+#include "Broom_TargetGate2D.h"
+#include "GameInstance.h"
+
+CBroom_TargetGate2D::CBroom_TargetGate2D(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
+ :CElementObject(pDevice, pContext)
+{
+}
+
+CBroom_TargetGate2D::CBroom_TargetGate2D(const CBroom_TargetGate2D& rhs)
+ :CElementObject(rhs)
+{
+}
+
+HRESULT CBroom_TargetGate2D::Initialize_Prototype()
+{
+ return S_OK;
+}
+
+HRESULT CBroom_TargetGate2D::Initialize(void* pArg)
+{
+ CUIObject::UIOBJECT_DESC Desc{};
+
+ Desc.fX = 0.f;
+ Desc.fY = -140.f;
+ Desc.fSizeX = 45.f;
+ Desc.fSizeY = 45.f;
+
+ m_pRect = { long(Desc.fX - Desc.fSizeX * 0.5f), long(Desc.fY - Desc.fSizeY * 0.5f), long(Desc.fX + Desc.fSizeX * 0.5f), long(Desc.fY + Desc.fSizeY * 0.5f) };
+
+ if (FAILED(__super::Initialize(&Desc)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(Ready_Components(pArg)))
+ {
+ return E_FAIL;
+ }
+
+ m_fTimeMult = 3.f;
+ m_fAlpha = 1.f;
+ m_fAlphaTime = 10.f;
+ return S_OK;
+}
+
+void CBroom_TargetGate2D::Priority_Update(_float fTimeDelta)
+{
+ if (!__super::Chack_Visible())
+ {
+ return;
+ }
+ __super::Priority_Update(fTimeDelta);
+}
+
+void CBroom_TargetGate2D::Update(_float fTimeDelta)
+{
+ if (!__super::Chack_Visible())
+ {
+ return;
+ }
+
+ if (m_bFadeIn == true)
+ {
+ if (m_fAlpha <= 1.f)
+ m_fAlpha += fTimeDelta * m_fAlphaTime;
+
+ if (m_fAlpha >= 1.f)
+ {
+ m_bFadeIn = false;
+ m_fAlpha = 1.f;
+ }
+ }
+
+ if (m_bFadeOut == true)
+ {
+ if (m_fAlpha >= 0.f)
+ m_fAlpha -= fTimeDelta;
+
+ if (m_fAlpha <= 0.f)
+ {
+ m_bFadeOut = false;
+ m_fAlpha = 0.f;
+ }
+ }
+
+ m_fTime += fTimeDelta * m_fTimeMult;
+
+ __super::Update(fTimeDelta);
+}
+
+void CBroom_TargetGate2D::Late_Update(_float fTimeDelta)
+{
+ if (!__super::Chack_Visible())
+ {
+ return;
+ }
+ if (m_bVisible) {
+ m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
+ __super::Late_Update(fTimeDelta);
+ }
+}
+
+HRESULT CBroom_TargetGate2D::Render()
+{
+ if (FAILED(Bind_ShaderResources())) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::DEFAULT)))) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pVIBufferCom->Bind_Resources())) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pVIBufferCom->Render())) {
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+
+_vector CBroom_TargetGate2D::Get_WorldPostion()
+{
+ return m_pTransformCom->Get_State(STATE::POSITION);
+}
+
+HRESULT CBroom_TargetGate2D::Bind_ShaderResources()
+{
+ if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix")))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pDiffuse_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_Texture", 0)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float))))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fTime", &m_fTime, sizeof(_float))))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fAlpha", &m_fAlpha, sizeof(_float))))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fOwnerAlpha", &m_fOwnerAlpha, sizeof(_float))))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fCanvasAlpha", &m_fCanvasAlpha, sizeof(_float))))
+ {
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+HRESULT CBroom_TargetGate2D::Ready_Components(void* pArg)
+{
+ if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_Map_RaceGate"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr)))
+ {
+ return E_FAIL;
+ }
+ if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr)))
+ {
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+CBroom_TargetGate2D* CBroom_TargetGate2D::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
+{
+ CBroom_TargetGate2D* pInstance = new CBroom_TargetGate2D(pDevice, pContext);
+
+ if (FAILED(pInstance->Initialize_Prototype()))
+ {
+ MSG_BOX("Failed to Created : CBroom_TargetGate2D");
+ SAFE_RELEASE(pInstance);
+ }
+
+ return pInstance;
+}
+
+CGameObject* CBroom_TargetGate2D::Clone(void* pArg, CGameObject* pOwner)
+{
+ CBroom_TargetGate2D* pInstance = new CBroom_TargetGate2D(*this);
+ pInstance->m_pOwner = pOwner;
+ if (FAILED(pInstance->Initialize(pArg)))
+ {
+ MSG_BOX("Failed to Cloned : CBroom_TargetGate2D");
+ SAFE_RELEASE(pInstance);
+ }
+
+ return pInstance;
+}
+
+void CBroom_TargetGate2D::Free()
+{
+ __super::Free();
+
+ SAFE_RELEASE(m_pDiffuse_TextureCom);
+ SAFE_RELEASE(m_pShaderCom);
+ SAFE_RELEASE(m_pVIBufferCom);
+}
+
+void CBroom_TargetGate2D::Describe_Entity()
+{
+}
diff --git a/Jusin154_Team3D/Editor/Private/Dialogue_Canvas.cpp b/Jusin154_Team3D/Editor/Private/Dialogue_Canvas.cpp
index 919fc4d6a..ec37f469a 100644
--- a/Jusin154_Team3D/Editor/Private/Dialogue_Canvas.cpp
+++ b/Jusin154_Team3D/Editor/Private/Dialogue_Canvas.cpp
@@ -40,7 +40,7 @@ HRESULT CDialogue_Canvas::Initialize(void* pArg)
{
return E_FAIL;
}
- Visible(true);
+ Visible(false);
return S_OK;
}
diff --git a/Jusin154_Team3D/Editor/Private/GamePlay_Canvas.cpp b/Jusin154_Team3D/Editor/Private/GamePlay_Canvas.cpp
index c453da583..49eda1b0f 100644
--- a/Jusin154_Team3D/Editor/Private/GamePlay_Canvas.cpp
+++ b/Jusin154_Team3D/Editor/Private/GamePlay_Canvas.cpp
@@ -48,7 +48,7 @@ HRESULT CGamePlay_Canvas::Initialize(void* pArg)
{
return E_FAIL;
}
- Visible(false);
+ Visible(true);
return S_OK;
}
diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp
index e03420d5d..a5b3338dd 100644
--- a/Jusin154_Team3D/Editor/Private/Loader.cpp
+++ b/Jusin154_Team3D/Editor/Private/Loader.cpp
@@ -135,6 +135,7 @@
#include "Broom_Record.h"
#include "Broom_Exit.h"
#include "broom_Trophy.h"
+#include "Broom_TargetGate2D.h"
#include "Ride_Panel.h"
#include "Ride_Info_Key.h"
@@ -1240,6 +1241,10 @@ HRESULT CLoader::Loading_For_UI()
{
return E_FAIL;
}
+ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBroom_TargetGate2D::Create(m_pDevice, m_pContext))))
+ {
+ return E_FAIL;
+ }
if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CRide_Panel::Create(m_pDevice, m_pContext))))
{
diff --git a/Jusin154_Team3D/Editor/Public/Broom_Panel.h b/Jusin154_Team3D/Editor/Public/Broom_Panel.h
index fd861eaf0..1e8459e01 100644
--- a/Jusin154_Team3D/Editor/Public/Broom_Panel.h
+++ b/Jusin154_Team3D/Editor/Public/Broom_Panel.h
@@ -38,6 +38,7 @@ class CBroom_Panel final : public CPanelObject
CGameObject* m_pBroom_Record = { nullptr };
CGameObject* m_pBroom_Exit = { nullptr };
CGameObject* m_pBroom_Trophy = { nullptr };
+ CGameObject* m_pBroom_TargetGate2D = { nullptr };
public:
static CBroom_Panel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
diff --git a/Jusin154_Team3D/Editor/Public/Broom_TargetGate2D.h b/Jusin154_Team3D/Editor/Public/Broom_TargetGate2D.h
new file mode 100644
index 000000000..bfe07431b
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Public/Broom_TargetGate2D.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#include "Editor_Define.h"
+#include "ElementObject.h"
+
+NS_BEGIN(Editor)
+
+class CBroom_TargetGate2D final : public CElementObject
+{
+private:
+ CBroom_TargetGate2D(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
+ CBroom_TargetGate2D(const CBroom_TargetGate2D& rhs);
+ virtual ~CBroom_TargetGate2D() = default;
+
+public:
+ virtual void Priority_Update(_float fTimeDelta);
+ virtual void Update(_float fTimeDelta);
+ virtual void Late_Update(_float fTimeDelta);
+ virtual HRESULT Render() override;
+ virtual _vector Get_WorldPostion() override;
+
+private:
+ virtual HRESULT Bind_ShaderResources() override;
+ virtual HRESULT Ready_Components(void* pArg) override;
+ virtual HRESULT Initialize_Prototype() override;
+ virtual HRESULT Initialize(void* pArg) override;
+
+private:
+ CTexture* m_pDiffuse_TextureCom = { nullptr };
+ CShader* m_pShaderCom = { nullptr };
+ CVIBuffer_Rect* m_pVIBufferCom = { nullptr };
+
+public:
+ static CBroom_TargetGate2D* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
+ virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
+ virtual void Free() override;
+ void Describe_Entity() override;
+};
+
+NS_END
diff --git a/Jusin154_Team3D/Engine/Private/PanelObject.cpp b/Jusin154_Team3D/Engine/Private/PanelObject.cpp
index 1cf136457..97d73d60a 100644
--- a/Jusin154_Team3D/Engine/Private/PanelObject.cpp
+++ b/Jusin154_Team3D/Engine/Private/PanelObject.cpp
@@ -261,6 +261,91 @@ _bool CPanelObject::Chack_Element(_float2 Position, _float2 Target, _float Scale
return false;
}
+_bool CPanelObject::World_Screen(_float3 fWorld_Pos, _float2& fScreenPos, _float& fDepth)
+{
+ _matrix mView = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW);
+ _matrix mProj = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ);
+ _matrix mVP = mView * mProj;
+
+ _vector Pos = XMVectorSet(fWorld_Pos.x, fWorld_Pos.y, fWorld_Pos.z, 1.f);
+ Pos = XMVector4Transform(Pos, mVP);
+
+ _float w = XMVectorGetW(Pos);
+
+ _bool bBehind = (w <= 0.f);
+
+ if (bBehind)
+ {
+ fDepth = -1.f;
+ return false;
+ }
+
+ _float NDCX = XMVectorGetX(Pos) / w;
+ _float NDCY = XMVectorGetY(Pos) / w;
+ _float NDCZ = XMVectorGetZ(Pos) / w;
+
+
+
+ fDepth = NDCZ;
+
+ fScreenPos.x = (NDCX + 1.f) * 0.5f * m_fWinSizeX;
+ fScreenPos.y = (1.f - NDCY) * 0.5f * m_fWinSizeY;
+
+ return true;
+}
+
+_bool CPanelObject::Screen(_float2& fWorld_Pos, _float Winx, _float Winy)
+{
+ return fWorld_Pos.x >= 0 && fWorld_Pos.x <= Winx &&
+ fWorld_Pos.y >= 0 && fWorld_Pos.y <= Winy;
+}
+
+_float2 CPanelObject::Get_EdgePosition(_float2 fWorld_Pos, _float Winx, _float Winy, _float OffSetY)
+{
+ _float2 center = _float2(Winx * 0.5f, Winy * 0.5f);
+ _float2 dir = _float2(fWorld_Pos.x - center.x, fWorld_Pos.y - center.y);
+
+ _float tX = FLT_MAX;
+ _float tY = FLT_MAX;
+
+ if (dir.x != 0.f)
+ tX = (dir.x > 0) ? (Winx - center.x) / dir.x : (0.f - center.x) / dir.x;
+
+ if (dir.y != 0.f)
+ tY = (dir.y > 0) ? (Winy - center.y) / dir.y : (0.f - center.y) / dir.y;
+
+ float t = min(tX, tY);
+
+ return _float2(dir.x * t,- dir.y * t - OffSetY);
+}
+
+_bool CPanelObject::World_to_ScreenUI(_float3 fWorld_Pos, _float2& fUIScreenPos, _float OffSetY)
+{
+ _float2 fScreenPos{};
+ _float fDepth{};
+
+ if (!World_Screen(fWorld_Pos, fScreenPos, fDepth))
+ {
+ fUIScreenPos.x = m_fWinSizeX * 0.5f;
+ fUIScreenPos.y = m_fWinSizeY - OffSetY;
+ return true;
+ }
+
+ _float fWinSizeX = static_cast<_float>(m_fWinSizeX);
+ _float fWinSizeY = static_cast<_float>(m_fWinSizeY);
+
+ if(Screen(fScreenPos, fWinSizeX, fWinSizeY))
+ {
+ return false;
+ }
+ else
+ {
+ fUIScreenPos = Get_EdgePosition(fScreenPos, fWinSizeX, fWinSizeY, OffSetY);
+ return true;
+ }
+
+}
+
CGameObject* CPanelObject::Find_Element(const wstring& Name)
{
auto iter = m_Elements_map.find(Name);
diff --git a/Jusin154_Team3D/Engine/Public/PanelObject.h b/Jusin154_Team3D/Engine/Public/PanelObject.h
index d49e14c04..533e124f5 100644
--- a/Jusin154_Team3D/Engine/Public/PanelObject.h
+++ b/Jusin154_Team3D/Engine/Public/PanelObject.h
@@ -42,6 +42,12 @@ class ENGINE_DLL CPanelObject abstract : public CUIObject
virtual _bool Chack_Visible() override;
virtual _bool Chack_Element(_float2 Position, _float2 Target, _float Scale, _float TargetScale);
+
+ _bool World_Screen(_float3 fWorld_Pos, _float2& fScreenPos, _float& fDepth);
+ _bool Screen(_float2& fWorld_Pos, _float Winx, _float Winy);
+ _float2 Get_EdgePosition(_float2 fWorld_Pos, _float Winx, _float Winy, _float OffSetY);
+ _bool World_to_ScreenUI(_float3 fWorld_Pos, _float2& fScreenPos, _float OffSetY);
+
protected:
vector m_Elements; // 패널이 엘리먼츠를 관리하기 위해 만듬
vector m_ElementName; // 엘리멘트들의 이름을 전해주기 위해서
@@ -51,6 +57,7 @@ class ENGINE_DLL CPanelObject abstract : public CUIObject
_int m_iElements_Count{}; // 전체 엘리멘트의 갯수
+ _bool m_bShowOffScreenUI = { false };
private:
virtual class CGameObject* Find_Element(const wstring& Name);