diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index fd32c126f..a7503bee5 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -525,7 +525,6 @@ PS_OUT PS_HpBar(PS_IN In) float4 tex1 = g_Texture.Sample(ClampSampler, Finaluv); Color = tex1; - float2 reversuv = In.vTexcoord; reversuv.x = 1.0f - Finaluv; @@ -537,7 +536,9 @@ PS_OUT PS_HpBar(PS_IN In) tex2.rgb = float3(0.f, 0.f, 0.f); } - tex2.rgb *= float3(112.f, 241.f, 31.f) / 255.f; + float3 Green = float3(112.f, 241.f, 31.f) / 255.f; + Green *= 1.2f; + tex2.rgb *= Green; if (all(Color.rgb >= float3(70.f / 255.f, 70.f / 255.f, 70.f / 255.f))) Color = tex2; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl index d6eae9ff4..d6b238656 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl @@ -3,6 +3,7 @@ matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix; Texture2D g_Texture; +Texture2D g_Texture1; float g_fAlpha; float g_fOwnerAlpha; @@ -97,6 +98,32 @@ PS_OUT PS_Alpha_Blend(PS_IN In) return Out; } +PS_OUT PS_Megic_Meter(PS_IN In) +{ + PS_OUT Out; + float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; + float3 Blue = float3(41.f, 165.f, 255.f) / 255.f; + + float4 color = float4(1.f, 1.f, 1.f, 1.f); + float4 tex1 = g_Texture.Sample(ClampSampler, In.vTexcoord); + float4 tex2 = g_Texture1.Sample(ClampSampler, In.vTexcoord); + + color = tex1; + tex2.rgb *= Blue * 1.5f; + + if (all(color.rgb >= float3(65.f / 255.f, 65.f / 255.f, 65.f / 255.f))) + color = tex2; + + //if(color.a <= 0.4f) + // discard; + + color.a *= Alpha; + + Out.vColor = color; + + return Out; +} + technique11 PosTexTechnique11 { pass Default @@ -120,4 +147,15 @@ technique11 PosTexTechnique11 GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Alpha_Blend(); } + + pass Megic_Meter + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + + VertexShader = compile vs_5_0 VS_MAIN(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_Megic_Meter(); + } } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/FinisherMeterOutline.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/FinisherMeterOutline.png new file mode 100644 index 000000000..2e6e2a594 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/FinisherMeterOutline.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/HpBarBG1.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/HpBarBG1.png deleted file mode 100644 index 0275521be..000000000 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/HpBarBG1.png and /dev/null differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_AncientMagicFinisher.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_AncientMagicFinisher.png new file mode 100644 index 000000000..99e1c8e34 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_AncientMagicFinisher.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HUD_HealthMeterFill.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HUD_HealthMeterFill.png index 574a9cb5e..b63ee71ec 100644 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HUD_HealthMeterFill.png and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HUD_HealthMeterFill.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HealthMeter_LeftEnd_4K.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HealthMeter_LeftEnd_4K.png deleted file mode 100644 index 600b313df..000000000 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HealthMeter_LeftEnd_4K.png and /dev/null differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HealthMeter_Middle_4K.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HealthMeter_Middle_4K.png deleted file mode 100644 index e6c2ab4f6..000000000 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HealthMeter_Middle_4K.png and /dev/null differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HealthMeter_RightEnd_4K.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HealthMeter_RightEnd_4K.png deleted file mode 100644 index f9ac9de3c..000000000 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_HealthMeter_RightEnd_4K.png and /dev/null differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_SpellDiamond_Red.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_SpellDiamond_Red.png deleted file mode 100644 index 4f7dffb00..000000000 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_SpellDiamond_Red.png and /dev/null differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_SpellTypeBack_Yellow.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_SpellTypeBack_Yellow.png deleted file mode 100644 index 9518d2203..000000000 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_SpellTypeBack_Yellow.png and /dev/null differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_SpellTypeDiamond_Forceful.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_SpellTypeDiamond_Forceful.png deleted file mode 100644 index 0a10588a0..000000000 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_SpellTypeDiamond_Forceful.png and /dev/null differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_AMFillPotion.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_AMFillPotion.png new file mode 100644 index 000000000..835903409 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_AMFillPotion.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_BeastBliss.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_BeastBliss.png new file mode 100644 index 000000000..28b07a644 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_BeastBliss.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Edurus.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Edurus.png new file mode 100644 index 000000000..a66c8633e Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Edurus.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_EssenceOfDittany.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_EssenceOfDittany.png new file mode 100644 index 000000000..90347927c Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_EssenceOfDittany.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_FelixFelicis.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_FelixFelicis.png new file mode 100644 index 000000000..15a3e3857 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_FelixFelicis.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Girding.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Girding.png new file mode 100644 index 000000000..946c872f1 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Girding.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_HorklumpJuice.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_HorklumpJuice.png new file mode 100644 index 000000000..1486cf649 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_HorklumpJuice.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_InvisibilityPotion.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_InvisibilityPotion.png new file mode 100644 index 000000000..6a0dc9b84 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_InvisibilityPotion.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Maxima.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Maxima.png new file mode 100644 index 000000000..647db47b6 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Maxima.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Sun_Syrup.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Sun_Syrup.png new file mode 100644 index 000000000..c8368887b Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_Sun_Syrup.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_WoundCleaning.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_WoundCleaning.png new file mode 100644 index 000000000..c971988e3 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Potions/UI_T_WoundCleaning.png differ diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index a28394512..f8cab33b2 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -209,6 +209,7 @@ + @@ -240,7 +241,9 @@ false + + @@ -338,6 +341,7 @@ + @@ -369,8 +373,9 @@ false - + + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 4a3cd82a4..9478e4fd4 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -343,6 +343,15 @@ {54eef1b7-a5ee-444f-9577-44ffc8c3d8bc} + + {b4e1da25-c952-4ff4-92fd-7f1501d8c005} + + + {7683f642-58f7-4a79-a78c-b29540bdab10} + + + {b6ec3441-6b18-45d1-80ba-03aa6df7f9e2} + {ee7ebf3c-8798-41cb-a261-31ca5041909c} @@ -702,6 +711,15 @@ 02.GameObjects\Camera\CameraPosition\Player\Target + + 50.UI\GamePlay_Canvas\Action_Panel\Spell_Slot_Preview + + + 50.UI\GamePlay_Canvas\Action_Panel\Potion + + + 50.UI\GamePlay_Canvas\Action_Panel\Magic_Meter + @@ -1021,6 +1039,15 @@ 02.GameObjects\Env\05.AlphaMap + + 50.UI\GamePlay_Canvas\Action_Panel\Spell_Slot_Preview + + + 50.UI\GamePlay_Canvas\Action_Panel\Potion + + + 50.UI\GamePlay_Canvas\Action_Panel\Magic_Meter + 02.GameObjects\Player diff --git a/Jusin154_Team3D/Editor/Private/Action_Panel.cpp b/Jusin154_Team3D/Editor/Private/Action_Panel.cpp index 6d43368e2..3cc914936 100644 --- a/Jusin154_Team3D/Editor/Private/Action_Panel.cpp +++ b/Jusin154_Team3D/Editor/Private/Action_Panel.cpp @@ -6,6 +6,7 @@ #include "Spell_Overlay.h" #include "Slot_Number.h" #include "HpBarBG.h" +#include "Magic_Meter.h" CAction_Panel::CAction_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CPanelObject(pDevice, pContext) @@ -144,13 +145,18 @@ HRESULT CAction_Panel::Ready_Element(void* pArg) return E_FAIL; } Add_Element(TEXT("HpBarBG"), m_pHpBarBG); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pMagic_Meter)))) + { + return E_FAIL; + } + Add_Element(TEXT("Magic_Meter"), m_pMagic_Meter); return S_OK; } CAction_Panel* CAction_Panel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { CAction_Panel* pInstance = new CAction_Panel(pDevice, pContext); - + if (FAILED(pInstance->Initialize_Prototype())) { MSG_BOX("Failed to Created : CAction_Panel"); diff --git a/Jusin154_Team3D/Editor/Private/Action_Panel.cpp.bak b/Jusin154_Team3D/Editor/Private/Action_Panel.cpp.bak new file mode 100644 index 000000000..c91f89041 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Action_Panel.cpp.bak @@ -0,0 +1,193 @@ +#include "pch.h" +#include "Action_Panel.h" +#include "GameInstance.h" +#include "Spell_Slot.h" +#include "Spell_Image.h" +#include "Spell_Overlay.h" +#include "Slot_Number.h" +#include "HpBarBG.h" +#include "Magic_Meter.h + +CAction_Panel::CAction_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CPanelObject(pDevice, pContext) +{ +} + +CAction_Panel::CAction_Panel(const CAction_Panel& rhs) + :CPanelObject(rhs) +{ +} + +HRESULT CAction_Panel::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CAction_Panel::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 1515.f; + Desc.fY = 850.f; + Desc.fSizeX = 700.f; + Desc.fSizeY = 400.f; + + + if (FAILED(__super::Initialize(&Desc))) + { + return E_FAIL; + } + if (FAILED(Ready_Components(pArg))) + { + return E_FAIL; + } + if (FAILED(Ready_Element(pArg))) + { + return E_FAIL; + } + + m_bVisible = true; + return S_OK; +} + +void CAction_Panel::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CAction_Panel::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + + __super::Update(fTimeDelta); +} + +void CAction_Panel::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + + if (m_bVisible) { + + } + __super::Late_Update(fTimeDelta); + +} + +HRESULT CAction_Panel::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 CAction_Panel::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CAction_Panel::Bind_ShaderResources() +{ + return S_OK; +} + +HRESULT CAction_Panel::Ready_Components(void* pArg) +{ + return S_OK; +} + +HRESULT CAction_Panel::Ready_Element(void* pArg) +{ + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast (&m_pSpell_Slot)))) + { + return E_FAIL; + } + Add_Element(TEXT("Spell_Slot"), m_pSpell_Slot); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpell_Image)))) + { + return E_FAIL; + } + Add_Element(TEXT("Spell_Image"), m_pSpell_Image); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpell_Overlay)))) + { + return E_FAIL; + } + Add_Element(TEXT("Spell_Overlay"), m_pSpell_Overlay); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSlot_Number)))) + { + return E_FAIL; + } + Add_Element(TEXT("Slot_Number"), m_pSlot_Number); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pHpBarBG)))) + { + return E_FAIL; + } + Add_Element(TEXT("HpBarBG"), m_pHpBarBG); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pMagic_Meter)))) + { + return E_FAIL; + } + Add_Element(TEXT("Magic_Meter"), m_pMagic_Meter); + return S_OK; +} + +CAction_Panel* CAction_Panel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CAction_Panel* pInstance = new CAction_Panel(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CAction_Panel"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CAction_Panel::Clone(void* pArg, CGameObject* pOwner) +{ + CAction_Panel* pInstance = new CAction_Panel(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CAction_Panel"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CAction_Panel::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +void CAction_Panel::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/HpBarBG.cpp b/Jusin154_Team3D/Editor/Private/HpBarBG.cpp index 453d3da78..886d6c437 100644 --- a/Jusin154_Team3D/Editor/Private/HpBarBG.cpp +++ b/Jusin154_Team3D/Editor/Private/HpBarBG.cpp @@ -45,6 +45,7 @@ HRESULT CHpBarBG::Initialize(void* pArg) m_fCurrentHp = m_fMaxHp; m_fMoveSpeed = 5.f; m_fHpBG = _float2(0, m_fSizeX); + SizeUpX(210.f); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp index 389d7fdc7..a59612686 100644 --- a/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp @@ -714,8 +714,8 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_Dummy(const _wstring& strLayerTag) - //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) - // return E_FAIL; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) + return E_FAIL; /*if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) return E_FAIL;*/ diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index f4cdf5893..9db50f28a 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -60,6 +60,8 @@ #include "Spell_Overlay.h" #include "Slot_Number.h" #include "HpBarBG.h" +#include "Potion.h" +#include "Magic_Meter.h" #include "IMGUIUI.h" @@ -400,6 +402,22 @@ HRESULT CLoader::Loading_For_UI() _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::UI), wstrFileName, + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { + return E_FAIL; + } + + return S_OK; + + }); + + Asset_FileLoad("../Bin/Resources/Textures/Potions", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) + { + + _string strFilePath = pFilePath; + _wstring wstrFilePath = CMyTools::ToWstring(strFilePath); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::UI), wstrFileName, CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, wstrFilePath.c_str(), 0)))) { return E_FAIL; @@ -429,6 +447,24 @@ HRESULT CLoader::Loading_For_UI() return E_FAIL; } + CVIBuffer_UI_Instance::UI_INSTANCE_DESC Magic_MeterDesc{}; + + Magic_MeterDesc.iNum = 5; + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Magic_Meter_UI_Instance"), + CVIBuffer_UI_Instance::Create(m_pDevice, m_pContext, &Magic_MeterDesc)))) { + return E_FAIL; + } + + CVIBuffer_UI_Instance::UI_INSTANCE_DESC Spell_Slot_PreviewDesc{}; + + Spell_Slot_PreviewDesc.iNum = 5; + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Spell_Slot_Previe_UI_Instance"), + CVIBuffer_UI_Instance::Create(m_pDevice, m_pContext, &Spell_Slot_PreviewDesc)))) { + return E_FAIL; + } + m_strMessage = TEXT("Shader Loading.."); if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_UIEDITOR, @@ -533,6 +569,14 @@ HRESULT CLoader::Loading_For_UI() { return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CPotion::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMagic_Meter::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CIMGUIUI::Create(m_pDevice, m_pContext)))) { @@ -1346,7 +1390,7 @@ HRESULT CLoader::Loading_For_ObjectViewer() #pragma region MONSTER futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/Goblin.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), + MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/Goblin.bin", XMMatrixIdentity(), TEXT("Prototype_Component_Goblin_Model") )); futures.emplace_back(Deferred_ModelLoad( @@ -1369,7 +1413,7 @@ HRESULT CLoader::Loading_For_ObjectViewer() TEXT("Prototype_Component_Npc_Model") )); futures.emplace_back(Deferred_ModelLoad( - MODEL::NONANIM, "../Bin/Resources/Models/Object/Wand/Wand.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(), + MODEL::NONANIM, "../Bin/Resources/Models/Object/Wand/Wand.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity(), TEXT("Prototype_Component_Wand_Model") )); futures.emplace_back(Deferred_ModelLoad( diff --git a/Jusin154_Team3D/Editor/Private/Magic_Meter.cpp b/Jusin154_Team3D/Editor/Private/Magic_Meter.cpp new file mode 100644 index 000000000..b9a3acdff --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Magic_Meter.cpp @@ -0,0 +1,293 @@ +#include "pch.h" +#include "Magic_Meter.h" +#include "GameInstance.h" + +CMagic_Meter::CMagic_Meter(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CMagic_Meter::CMagic_Meter(const CMagic_Meter& rhs) + :CElementObject(rhs) +{ +} + +HRESULT CMagic_Meter::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CMagic_Meter::Initialize(void* pArg) +{ + + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 130.f; + Desc.fY = 145.f; + Desc.fSizeX = 80.f; + Desc.fSizeY = 20.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_fAlpha = 1.f; + m_fTimeMult = 3.f; + m_fAngle = XMConvertToRadians(45); + m_fAlphaTime = 1.f; + m_iCols = 5; + UV(); + m_pVIBufferCom->Set_Cloned(true); + m_pVIBufferCom->Set_Pos(0.f, 0.f, -65.f, m_fSizeY, m_iCols); + m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); + m_pVIBufferCom->Set_ImageUV(pUVDesc); + return S_OK; +} + +void CMagic_Meter::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CMagic_Meter::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 CMagic_Meter::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) + { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + } + __super::Late_Update(fTimeDelta); +} + +HRESULT CMagic_Meter::Render() +{ + if (FAILED(Bind_ShaderResources())) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIINTANCE::MAGIC_METER)))) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) + { + return E_FAIL; + } + + return S_OK; +} + + +_vector CMagic_Meter::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +void CMagic_Meter::UV() +{ + pUVDesc[0].fUVStart = Compute_UVX(1); + pUVDesc[0].fUVEnd = Compute_UVY(1); + pUVDesc[1].fUVStart = Compute_UVX(2); + pUVDesc[1].fUVEnd = Compute_UVY(2); + pUVDesc[2].fUVStart = Compute_UVX(2); + pUVDesc[2].fUVEnd = Compute_UVY(2); + pUVDesc[3].fUVStart = Compute_UVX(2); + pUVDesc[3].fUVEnd = Compute_UVY(2); + pUVDesc[4].fUVStart = Compute_UVX(0); + pUVDesc[4].fUVEnd = Compute_UVY(0); +} + +_float2 CMagic_Meter::Compute_UVX(_uint Number) +{ + m_fIamge_Size = { 128, 96 }; + + _uint iXCount = 1; + _uint iYCount = 3; + + _float frameWidth = 128.f; + _float frameHeight = 32.f; + + _uint frameX = Number % iXCount; + _uint frameY = Number / iXCount; + + _float2 UVStart; + UVStart.x = frameX * frameWidth / m_fIamge_Size.x; + UVStart.y = frameY * frameHeight / m_fIamge_Size.y; + + return UVStart; +} + +_float2 CMagic_Meter::Compute_UVY(_uint Number) +{ + m_fIamge_Size = { 320.f, 128.f }; + + _float frameWidth = 128.f; + _float frameHeight = 32.f; + + // Start 구함 + _float2 UVStart = Compute_UVX(Number); + + _float2 UVEnd; + UVEnd.x = UVStart.x + (frameWidth / m_fIamge_Size.x); + UVEnd.y = UVStart.y + (frameHeight / m_fIamge_Size.y); + + return UVEnd; +} + +HRESULT CMagic_Meter::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_pDiffuse_TextureCom1->Bind_ShaderResource(m_pShaderCom, "g_Texture1", 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_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 CMagic_Meter::Ready_Components(void* pArg) +{ + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Magic_Meter_UI_Instance"), (CComponent**)&m_pVIBufferCom, nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_FinisherMeterOutline"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_HUD_HealthMeterFill"), reinterpret_cast(&m_pDiffuse_TextureCom1), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIINSTANCE, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + + +CMagic_Meter* CMagic_Meter::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CMagic_Meter* pInstance = new CMagic_Meter(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CMagic_Meter"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CMagic_Meter::Clone(void* pArg, CGameObject* pOwner) +{ + CMagic_Meter* pInstance = new CMagic_Meter(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpell_Slot"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CMagic_Meter::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pDiffuse_TextureCom1); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +void CMagic_Meter::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/Player.cpp b/Jusin154_Team3D/Editor/Private/Player.cpp index 3d5ebb5cf..0f7853c4d 100644 --- a/Jusin154_Team3D/Editor/Private/Player.cpp +++ b/Jusin154_Team3D/Editor/Private/Player.cpp @@ -57,6 +57,8 @@ HRESULT CPlayer::Initialize(void* pArg) Set_Anim(); + m_eSpell = STATEANIM::DESCENDO; + { CFSM::FSM_DESC FSMDesc{}; FSMDesc.pStates = &m_States; @@ -80,6 +82,8 @@ void CPlayer::Priority_Update(_float fTimeDelta) void CPlayer::Update(_float fTimeDelta) { + __super::Update(fTimeDelta); + m_pFSM->Update_State(fTimeDelta); @@ -92,6 +96,7 @@ void CPlayer::Update(_float fTimeDelta) m_pCharacter_Controller->Move(fTimeDelta); + TestKeyInput(fTimeDelta); } void CPlayer::Late_Update(_float fTimeDelta) @@ -105,6 +110,8 @@ void CPlayer::Late_Update(_float fTimeDelta) HRESULT CPlayer::Render() { + if (!m_bVisible) + return S_OK; if (FAILED(Bind_ShaderResources())) { return E_FAIL; } @@ -235,13 +242,634 @@ HRESULT CPlayer::Bind_ShaderResources() if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) { return E_FAIL; } - if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { return E_FAIL; } return S_OK; } +void CPlayer::TestKeyInput(_float fTimeDelta) +{ + if (m_pGameInstance->Key_Down(DIK_F1)) + { + m_eSpell = STATEANIM::ACCIO; + } + if (m_pGameInstance->Key_Down(DIK_F2)) + { + m_eSpell = STATEANIM::DESCENDO; + } + if (m_pGameInstance->Key_Down(DIK_F3)) + { + m_eSpell = STATEANIM::DEPULSO; + } + if (m_pGameInstance->Key_Down(DIK_F4)) + { + m_eSpell = STATEANIM::DIFFINDO; + } + if (m_pGameInstance->Key_Down(DIK_F5)) + { + m_eSpell = STATEANIM::DISILLUSION_ENTER; + } + if (m_pGameInstance->Key_Down(DIK_F6)) + { + m_eSpell = STATEANIM::DISILLUSION_EXIT; + } + +} + +HRESULT CPlayer::InputAction() +{ + if ( + m_pGameInstance->Key_Down(DIK_SPACE) + || m_pGameInstance->Key_Down(DIK_LCONTROL) + || m_pGameInstance->Key_Down(DIK_E) + || m_pGameInstance->Key_Down(DIK_R) + || m_pGameInstance->Key_Down(DIK_Q) + || m_pGameInstance->Mouse_Up(DIM_LBUTTON) + || m_pGameInstance->Key_Down(DIK_LSHIFT) + || m_pGameInstance->Key_Down(DIK_C) + || m_pGameInstance->Key_Down(DIK_V) + ) + { + return S_OK; + } + return E_FAIL; +} + +HRESULT CPlayer::InputMove() +{ + if (m_pGameInstance->Key_Pressing(DIK_W) + || m_pGameInstance->Key_Pressing(DIK_A) + || m_pGameInstance->Key_Pressing(DIK_S) + || m_pGameInstance->Key_Pressing(DIK_D)) + { + return S_OK; + } + return E_FAIL; +} + +HRESULT CPlayer::InputSpell() +{ + if ( + m_pGameInstance->Key_Down(DIK_1) + || m_pGameInstance->Key_Down(DIK_2) + || m_pGameInstance->Key_Down(DIK_3) + || m_pGameInstance->Key_Down(DIK_4) + ) + { + return S_OK; + } + return E_FAIL; +} + +void CPlayer::Behavior_IdleEnter() { + m_pFSM->Enable_State(FSMSTATE::IDLE); + pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::IDLE]; + + if (m_pFSM->IsEnable_Previous(FSMSTATE::JOG|FSMSTATE::WALK| FSMSTATE::SPRINT)) { + + if (m_pFSM->IsEnable_Previous(FSMSTATE::WALK)) { + pairAnimInfo = m_Animation[STATEANIM::WALK_STOP]; + } + else if (m_pFSM->IsEnable_Previous(FSMSTATE::SPRINT)) { + pairAnimInfo = m_Animation[STATEANIM::JOG_STOP]; + } + + else if (m_pFSM->IsEnable_Previous(FSMSTATE::JOG)) { + pairAnimInfo = m_Animation[STATEANIM::JOG_STOP]; + } + } + m_bSprintToggle = false; + m_bWalkToggle = false; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); +} + +HRESULT CPlayer::Behavior_IdleExitCheck() +{ + // S_OK -> 현 상태 유지 + // E_FAIL -> 현 상태 탈출 + if (SUCCEEDED(InputAction())|| SUCCEEDED(InputSpell())) { + if (m_pGameInstance->Key_Down(DIK_SPACE)) { + m_pFSM->Change_State(FSMSTATE::JUMP); + } + else if (m_pGameInstance->Key_Down(DIK_LCONTROL)) { + m_pFSM->Change_State(FSMSTATE::DODGE); + } + else if (m_pGameInstance->Key_Down(DIK_R)) { + m_pFSM->Change_State(FSMSTATE::COMBAT); + } + else if (m_pGameInstance->Key_Down(DIK_Q)) { + m_pFSM->Change_State(FSMSTATE::COMBAT); + } + else if (SUCCEEDED(InputSpell())) { + m_pFSM->Change_State(FSMSTATE::COMBAT); + } + else if (m_pGameInstance->Mouse_Up(DIM_LBUTTON)) { + m_pFSM->Change_State(FSMSTATE::COMBAT); + } + else if (m_pGameInstance->Key_Down(DIK_V)) { + m_pFSM->Change_State(FSMSTATE::COMBAT); + } + + return E_FAIL; + } + if (SUCCEEDED(InputMove())) { + m_pFSM->Change_State(FSMSTATE::MOVE); + return E_FAIL; + } + + if (m_pModelCom->IsFinishedAnim()) + { + pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::IDLE]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + } + return S_OK; +} + +void CPlayer::Behavior_IdleExit() +{ + m_pFSM->Disable_State(FSMSTATE::IDLE); +} + +void CPlayer::Behavior_MoveEnter() +{ + pair<_uint, _bool> pairAnimInfo = {}; + _bool bFoward = m_pGameInstance->Key_Pressing(DIK_W); + _bool bLeft = m_pGameInstance->Key_Pressing(DIK_A); + _bool bRight = m_pGameInstance->Key_Pressing(DIK_D); + _bool bBackward = m_pGameInstance->Key_Pressing(DIK_S); + m_pFSM->Enable_State(FSMSTATE::MOVE); + if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE | FSMSTATE::DODGE)) { + if (true == m_bSprintToggle) { + m_pFSM->Enable_State(FSMSTATE::SPRINT); + m_bWalkToggle = false; + if (true == bFoward) { + pairAnimInfo = m_Animation[STATEANIM::SPRINT]; + } + } + else if (true == m_bWalkToggle) { + m_pFSM->Enable_State(FSMSTATE::WALK); + m_bSprintToggle = false; + if (true == bFoward) { + pairAnimInfo = m_Animation[STATEANIM::WALK_FWD]; + } + else if (true == bBackward) { + pairAnimInfo = m_Animation[STATEANIM::WALK_BWD]; + } + } + else + { + m_pFSM->Enable_State(FSMSTATE::JOG); + m_bSprintToggle = false; + m_bWalkToggle = false; + pairAnimInfo = m_Animation[STATEANIM::JOG_FWD]; + } + } + else { // While Moving + if (true == m_bSprintToggle) { + m_pFSM->Enable_State(FSMSTATE::SPRINT); + m_bWalkToggle = false; + pairAnimInfo = m_Animation[STATEANIM::SPRINT]; + + } + else if (true == m_bWalkToggle) { + m_pFSM->Enable_State(FSMSTATE::WALK); + m_bSprintToggle = false; + if (true == bFoward) { + pairAnimInfo = m_Animation[STATEANIM::WALK_FWD]; + } + else if (true == bBackward){ + pairAnimInfo = m_Animation[STATEANIM::WALK_BWD]; + } + } + else { + m_pFSM->Enable_State(FSMSTATE::JOG); + m_bSprintToggle = false; + m_bWalkToggle = false; + pairAnimInfo = m_Animation[STATEANIM::JOG_FWD]; + } + } + + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); +} + +HRESULT CPlayer::Behavior_MoveExitCheck() +{ + pair<_uint, _bool> pairAnimInfo; + if (SUCCEEDED(InputAction())|| SUCCEEDED(InputSpell())) { + if (m_pGameInstance->Key_Down(DIK_SPACE)) { + m_pFSM->Change_State(FSMSTATE::JUMP); + } + else if (m_pGameInstance->Key_Down(DIK_LCONTROL)) { + m_pFSM->Change_State(FSMSTATE::DODGE); + } + else if (m_pGameInstance->Key_Down(DIK_R)) { + m_pFSM->Change_State(FSMSTATE::COMBAT); + } + else if (m_pGameInstance->Key_Down(DIK_Q)) { + m_pFSM->Change_State(FSMSTATE::COMBAT); + } + else if (m_pGameInstance->Mouse_Up(DIM_LBUTTON)) { + m_pFSM->Change_State(FSMSTATE::COMBAT); + } + else if (SUCCEEDED(InputSpell())) { + m_pFSM->Change_State(FSMSTATE::COMBAT); + } + else if (m_pGameInstance->Key_Down(DIK_V)) { + m_pFSM->Change_State(FSMSTATE::COMBAT); + } + else if (m_pGameInstance->Key_Down(DIK_LSHIFT)) { + m_bSprintToggle = !m_bSprintToggle; + m_bWalkToggle = false; + if (m_bSprintToggle) + { + m_pFSM->Enable_State(FSMSTATE::SPRINT); + + pairAnimInfo = m_Animation[STATEANIM::SPRINT]; + } + else + { + m_pFSM->Enable_State(FSMSTATE::JOG); + m_pFSM->Disable_State(FSMSTATE::SPRINT); + pairAnimInfo = m_Animation[STATEANIM::JOG_FWD]; + } + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + } + else if (m_pGameInstance->Key_Down(DIK_C)) { + m_bWalkToggle = !m_bWalkToggle; + m_bSprintToggle= false; + if (m_bWalkToggle) + { + m_pFSM->Enable_State(FSMSTATE::WALK); + pairAnimInfo = m_Animation[STATEANIM::WALK_FWD]; + } + else + { + m_pFSM->Enable_State(FSMSTATE::JOG); + m_pFSM->Disable_State(FSMSTATE::WALK); + pairAnimInfo = m_Animation[STATEANIM::JOG_FWD]; + } + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + } + return E_FAIL; + } + if (SUCCEEDED(InputMove())) { + return S_OK; + } + + m_pFSM->Change_State(FSMSTATE::IDLE); + + return E_FAIL; +} + +void CPlayer::Behavior_MoveExit() +{ + m_pFSM->Disable_State(FSMSTATE::MOVE | FSMSTATE::SPRINT | FSMSTATE::JOG | FSMSTATE::WALK); +} + +void CPlayer::Behavior_JumpEnter() +{ + pair<_uint, _bool> pairAnimInfo; + m_pFSM->Enable_State(FSMSTATE::JUMP); + if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE|FSMSTATE::WALK|FSMSTATE::JOG|FSMSTATE::SPRINT)) { + if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE)) { + pairAnimInfo = Get_AnimInfo(STATEANIM::JUMP); + } + else if (m_pFSM->IsEnable_Previous(FSMSTATE::SPRINT)) { + pairAnimInfo = m_Animation[STATEANIM::JUMP_SPRINT]; + } + else if (m_pFSM->IsEnable_Previous(FSMSTATE::WALK)) { + pairAnimInfo = Get_AnimInfo(STATEANIM::JUMP); + } + else if (m_pFSM->IsEnable_Previous(FSMSTATE::JOG)) { + pairAnimInfo = Get_AnimInfo(STATEANIM::JUMP_JOG); + } + } + else { + // Drop? + } + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); +} + +HRESULT CPlayer::Behavior_JumpExitCheck() +{ + if (IsCurrentKeyFrame("Jump")) { + m_pFSM->Change_State(FSMSTATE::LAND); + return E_FAIL; + } + return S_OK; +} + +void CPlayer::Behavior_JumpExit() +{ + m_pFSM->Disable_State(FSMSTATE::JUMP); +} + +void CPlayer::Behavior_LandEnter() +{ + m_pFSM->Enable_State(FSMSTATE::LAND); + pair<_uint, _bool> pairAnimInfo = Get_AnimInfo(STATEANIM::LAND); + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); +} + +HRESULT CPlayer::Behavior_LandExitCheck() +{ + if (m_pModelCom->IsFinishedAnim()){ + m_pFSM->Change_State(FSMSTATE::IDLE); + return E_FAIL; + } // 혹시 Land to (Jog, Sprint, Dodge) 같은 애니메이션 있으면 여기에 분기 조건 넣으면 됨 + + if (SUCCEEDED(InputMove())) { + m_pFSM->Change_State(FSMSTATE::MOVE); + return E_FAIL; + } + return S_OK; +} + +void CPlayer::Behavior_LandExit() +{ + m_pFSM->Disable_State(FSMSTATE::LAND); +} + +void CPlayer::Behavior_DodgeEnter() +{ + // 혹시 @@ to Dodge 있으면 여기에 + m_pFSM->Enable_State(FSMSTATE::DODGE); + pair<_uint, _bool> pairAnimInfo = Get_AnimInfo(STATEANIM::DODGE); + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); +} + +HRESULT CPlayer::Behavior_DodgeExitCheck() +{ + if (m_pModelCom->IsFinishedAnim()){ + m_pFSM->Change_State(FSMSTATE::IDLE); + return E_FAIL; + } + return S_OK; +} + +void CPlayer::Behavior_DodgeExit() +{ + m_pFSM->Disable_State(FSMSTATE::DODGE); +} + +void CPlayer::Behavior_CombatEnter() +{ + pair<_uint, _bool> pairAnimInfo = {}; + m_pFSM->Enable_State(FSMSTATE::COMBAT); + + if (m_pGameInstance->Key_Down(DIK_R)) { + m_pFSM->Enable_State(FSMSTATE::SKILL); + pairAnimInfo = m_Animation[STATEANIM::SKILL]; + } + else if (m_pGameInstance->Key_Down(DIK_Q)) { + m_pFSM->Enable_State(FSMSTATE::SKILL2); + pairAnimInfo = m_Animation[STATEANIM::SKILL2]; + } + else if (m_pGameInstance->Mouse_Up(DIM_LBUTTON)) { + m_pFSM->Enable_State(FSMSTATE::LIGHT_ATTACK); + pairAnimInfo = m_Animation[STATEANIM::LIGHT_ATTACK]; + } + else if (SUCCEEDED(InputSpell())) { + m_pFSM->Enable_State(FSMSTATE::SPELL); + if (m_eSpell != STATEANIM::END) + { + switch (m_eSpell) + { + case STATEANIM::DEPULSO: + pairAnimInfo = m_Animation[STATEANIM::DEPULSO]; + m_eSpell = STATEANIM::END; + break; + case STATEANIM::DIFFINDO: + pairAnimInfo = m_Animation[STATEANIM::DIFFINDO]; + m_eSpell = STATEANIM::END; + break; + case STATEANIM::DISILLUSION_ENTER: + pairAnimInfo = m_Animation[STATEANIM::DISILLUSION_ENTER]; + m_eSpell = STATEANIM::END; + break; + case STATEANIM::DISILLUSION_EXIT: + pairAnimInfo = m_Animation[STATEANIM::DISILLUSION_EXIT]; + m_eSpell = STATEANIM::END; + break; + default: + pairAnimInfo = m_Animation[STATEANIM::SPELL]; + break; + } + } + else + pairAnimInfo = m_Animation[STATEANIM::SPELL]; + } + else if (m_pGameInstance->Key_Down(DIK_V)) { + m_pFSM->Enable_State(FSMSTATE::MAPHELP); + pairAnimInfo = m_Animation[STATEANIM::MAPHELP]; + + } + + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); +} + +HRESULT CPlayer::Behavior_CombatExitCheck() +{ + pair<_uint, _bool> pairAnimInfo; + if (SUCCEEDED(InputAction())|| SUCCEEDED(InputSpell())) { + if (m_pGameInstance->Key_Down(DIK_R)) + { + m_pFSM->Enable_State(FSMSTATE::SKILL); + } + else if (m_pGameInstance->Key_Down(DIK_Q)) + { + m_pFSM->Enable_State(FSMSTATE::SKILL2); + pairAnimInfo = m_Animation[STATEANIM::SKILL2]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + } + else if (m_pGameInstance->Mouse_Up(DIM_LBUTTON)) + { + m_pFSM->Enable_State(FSMSTATE::LIGHT_ATTACK); + _uint iIndex = m_pModelCom->Get_AnimIndex(); + if (m_Animation[STATEANIM::LIGHT_ATTACK].first <= iIndex && m_Animation[STATEANIM::LIGHT_ATTACK].first + 3 > iIndex) { + _float fRatio = m_pModelCom->Get_CurrentTrackProgressRatio(); + if (fRatio >= 0.1f) { + pairAnimInfo = m_Animation[STATEANIM::LIGHT_ATTACK]; + pairAnimInfo.first = iIndex + 1; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + } + } + } + else if (SUCCEEDED(InputSpell())) + { + m_pFSM->Enable_State(FSMSTATE::SPELL); + _uint iIndex = m_pModelCom->Get_AnimIndex(); + if (m_Animation[STATEANIM::SPELL].first <= iIndex && m_Animation[STATEANIM::SPELL].first + 3 > iIndex) { + _float fRatio = m_pModelCom->Get_CurrentTrackProgressRatio(); + if (fRatio >= 0.15f) { + pairAnimInfo = m_Animation[STATEANIM::SPELL]; + pairAnimInfo.first = iIndex + 1; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + } + } + } + else if (m_pGameInstance->Key_Down(DIK_V)) + { + m_pFSM->Enable_State(FSMSTATE::MAPHELP); + pairAnimInfo = m_Animation[STATEANIM::MAPHELP]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + } + } + + if (m_pFSM->IsEnable(FSMSTATE::SPELL)&& IsCurrentKeyFrame("Combat")) + { + if (m_eSpell != STATEANIM::END) + { + switch (m_eSpell) + { + case STATEANIM::ACCIO: + pairAnimInfo = m_Animation[STATEANIM::ACCIO]; + break; + case STATEANIM::DESCENDO: + pairAnimInfo = m_Animation[STATEANIM::DESCENDO]; + break; + default: + break; + } + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_eSpell = STATEANIM::END; + return E_FAIL; + } + } + + if (SUCCEEDED(InputMove()) && IsCurrentKeyFrame("Combat")) { + m_pFSM->Change_State(FSMSTATE::MOVE); + return E_FAIL; + } + + if (m_pModelCom->IsFinishedAnim()) { + m_pFSM->Change_State(FSMSTATE::IDLE); + return E_FAIL; + } + + return E_FAIL; +} + +void CPlayer::Behavior_CombatExit() +{ + m_pFSM->Disable_State(FSMSTATE::COMBAT | FSMSTATE::LIGHT_ATTACK | FSMSTATE::SPELL | FSMSTATE::SKILL | FSMSTATE::SKILL2 | FSMSTATE::MAPHELP); +} + +void CPlayer::Add_FSM() +{ +#pragma region Behavior_Movement_NotFocus + { + CState_Idle::STATE_IDLE_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_IdleEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_IdleExitCheck(); }; + Desc.funcExitEvent = [this]() { Behavior_IdleExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::IDLE, CState_Idle::Create(&Desc)); + } + { + CState_Move::STATE_MOVE_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_MoveEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_MoveExitCheck(); }; + Desc.funcExitEvent = [this]() { Behavior_MoveExit(); }; + Desc.funcPriorityUpdate = [this](_float fTimeDelta) { + if (m_pGameInstance->Key_Pressing(DIK_A)) {m_pTransformCom->Turn(-m_pTransformCom->Get_State(STATE::UP), fTimeDelta);} + if (m_pGameInstance->Key_Pressing(DIK_D)) { m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta);}; + }; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::MOVE, CState_Move::Create(&Desc)); + } +#pragma endregion +#pragma region Behavior_Movement_Focus + { + CState_Jump::STATE_JUMP_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_JumpEnter(); }; + Desc.funcExitCheck = [this](_float fTimeDelta) { return Behavior_JumpExitCheck(); }; + Desc.funcExitEvent = [this]() { Behavior_JumpExit(); }; + m_States.emplace(FSMSTATE::JUMP, CState_Jump::Create(&Desc)); + } + { + CState_Land::STATE_LAND_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_LandEnter(); }; + Desc.funcExitCheck = [this](_float fTimeDelta) { return Behavior_LandExitCheck(); }; + Desc.funcExitEvent = [this]() { Behavior_LandExit(); }; + m_States.emplace(FSMSTATE::LAND, CState_Land::Create(&Desc)); + } + { + CState_Dodge::STATE_DODGE_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_DodgeEnter(); }; + Desc.funcExitCheck = [this](_float fTimeDelta) { return Behavior_DodgeExitCheck(); }; + Desc.funcExitEvent = [this]() { Behavior_DodgeExit(); }; + Desc.funcPriorityUpdate = [this](_float fTimeDelta) { + if (m_pGameInstance->Key_Pressing(DIK_A)) { m_pTransformCom->Turn(-m_pTransformCom->Get_State(STATE::UP), fTimeDelta); } + if (m_pGameInstance->Key_Pressing(DIK_D)) { m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta); }; + }; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::DODGE, CState_Dodge::Create(&Desc)); + } +#pragma endregion +#pragma region Behavior_Combat_NotFocus + { + CState_Combat::STATE_COMBAT_DESC Desc{}; + Desc.pOwner = this; + Desc.funcEnterEvent = [this]() { Behavior_CombatEnter(); }; + Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_CombatExitCheck(); }; + Desc.funcExitEvent = [this]() { Behavior_CombatExit(); }; + Desc.funcPriorityUpdate = nullptr; + Desc.funcLateUpdate = nullptr; + m_States.emplace(FSMSTATE::COMBAT, CState_Combat::Create(&Desc)); + } +#pragma endregion +#pragma region Behavior_Combat_Focus + +#pragma endregion + +} + +void CPlayer::Set_Anim() +{ + m_Animation[STATEANIM::IDLE] = { 266,true }; + m_Animation[STATEANIM::IDLE_TURN_L] = { 270,false }; + m_Animation[STATEANIM::IDLE_TURN_R] = { 430,false }; + m_Animation[STATEANIM::IDLE_TURN_BWD] = { 268,false }; + + m_Animation[STATEANIM::WALK_FWD] = { 625,true }; + m_Animation[STATEANIM::WALK_BWD] = { 166,true }; + m_Animation[STATEANIM::WALK_STOP] = { 344,false }; + + m_Animation[STATEANIM::JOG_FWD] = { 167,true }; + m_Animation[STATEANIM::JOG_STOP] = { 289,false }; + + m_Animation[STATEANIM::JUMP] = { 205,false }; + m_Animation[STATEANIM::JUMP_JOG] = { 203,false }; + m_Animation[STATEANIM::JUMP_SPRINT] = { 207,false }; + + m_Animation[STATEANIM::SPRINT] = { 599,true }; + + m_Animation[STATEANIM::LAND] = { 259,false }; + + m_Animation[STATEANIM::DODGE] = { 802,false }; + + m_Animation[STATEANIM::SKILL] = { 593,false }; + m_Animation[STATEANIM::SKILL2] = { 915,false }; + m_Animation[STATEANIM::LIGHT_ATTACK] = { 413,false }; + m_Animation[STATEANIM::SPELL] = { 696,false }; + m_Animation[STATEANIM::MAPHELP] = { 122,false }; + m_Animation[STATEANIM::ACCIO] = { 417,false }; + m_Animation[STATEANIM::DESCENDO] = { 418,false }; + m_Animation[STATEANIM::DEPULSO] = { 782,false }; + m_Animation[STATEANIM::DIFFINDO] = { 786,false }; + m_Animation[STATEANIM::LUMOS] = { 782,false }; + m_Animation[STATEANIM::DISILLUSION_ENTER] = { 585,false }; + m_Animation[STATEANIM::DISILLUSION_EXIT] = { 586,false }; +} + CPlayer* CPlayer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { CPlayer* pInstance = new CPlayer(pDevice, pContext); @@ -314,4 +942,10 @@ void CPlayer::Describe_Entity() float Rot3[3] = { RotR, RotU,RotL }; GUI::DragFloat3("Rot", Rot3); + + string AnimList = m_pModelCom->Get_AnimList(m_pModelCom->Get_AnimIndex()); + GUI::Text(AnimList.c_str()); + + GUI::Checkbox("Render", &m_bVisible); + } diff --git a/Jusin154_Team3D/Editor/Private/Potion.cpp b/Jusin154_Team3D/Editor/Private/Potion.cpp new file mode 100644 index 000000000..49ede637d --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Potion.cpp @@ -0,0 +1,222 @@ +#include "pch.h" +#include "Potion.h" +#include "GameInstance.h" + +CPotion::CPotion(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CPotion::CPotion(const CPotion& rhs) + :CElementObject(rhs) +{ +} + +HRESULT CPotion::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CPotion::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 220.f; + Desc.fY = 180.f; + Desc.fSizeX = 144.f; + Desc.fSizeY = 24.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 = 1.f; + return S_OK; +} + +void CPotion::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + + +void CPotion::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 CPotion::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + __super::Late_Update(fTimeDelta); + } +} + +HRESULT CPotion::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 CPotion::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CPotion::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 CPotion::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_WoundCleaning"), 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; +} + +CPotion* CPotion::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CPotion* pInstance = new CPotion(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CPotion"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CPotion::Clone(void* pArg, CGameObject* pOwner) +{ + CPotion* pInstance = new CPotion(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpell_Image"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CPotion::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +void CPotion::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/Spell_Slot_Preview.cpp b/Jusin154_Team3D/Editor/Private/Spell_Slot_Preview.cpp new file mode 100644 index 000000000..9820becb0 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Spell_Slot_Preview.cpp @@ -0,0 +1,231 @@ +#include "pch.h" +#include "Spell_Slot_Preview.h" +#include "GameInstance.h" + +CSpell_Slot_Preview::CSpell_Slot_Preview(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CSpell_Slot_Preview::CSpell_Slot_Preview(const CSpell_Slot_Preview& rhs) + :CElementObject(rhs) +{ +} + +HRESULT CSpell_Slot_Preview::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CSpell_Slot_Preview::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 0.f; + Desc.fY = 0.f; + Desc.fSizeX = 100.f; + Desc.fSizeY = 100.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_fAlpha = 1.f; + m_fTimeMult = 3.f; + m_fAngle = XMConvertToRadians(45); + m_fAlphaTime = 1.f; + m_pVIBufferCom->Set_Cloned(true); + //m_pVIBufferCom->Set_Pos(0.f, 0.f, m_fOffSetX, m_fOffSetY, m_iCols); + m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); + m_pVIBufferCom->Set_ImageUV(); + return S_OK; +} + +void CSpell_Slot_Preview::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CSpell_Slot_Preview::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 CSpell_Slot_Preview::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) + { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + } + __super::Late_Update(fTimeDelta); +} + +HRESULT CSpell_Slot_Preview::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 CSpell_Slot_Preview::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CSpell_Slot_Preview::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_fAngle", &m_fAngle, 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 CSpell_Slot_Preview::Ready_Components(void* pArg) +{ + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Spell_Slot_Previe_UI_Instance"), (CComponent**)&m_pVIBufferCom, nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_ActionItemGoldleaf_4K"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIINSTANCE, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +CSpell_Slot_Preview* CSpell_Slot_Preview::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CSpell_Slot_Preview* pInstance = new CSpell_Slot_Preview(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CSpell_Slot_Preview"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CSpell_Slot_Preview::Clone(void* pArg, CGameObject* pOwner) +{ + CSpell_Slot_Preview* pInstance = new CSpell_Slot_Preview(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpell_Slot"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CSpell_Slot_Preview::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +void CSpell_Slot_Preview::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/Wand.cpp b/Jusin154_Team3D/Editor/Private/Wand.cpp index 5412960a8..1c904ec41 100644 --- a/Jusin154_Team3D/Editor/Private/Wand.cpp +++ b/Jusin154_Team3D/Editor/Private/Wand.cpp @@ -43,10 +43,6 @@ void CWand::Priority_Update(_float fTimeDelta) socketMatrix.r[i] = XMVector3Normalize(socketMatrix.r[i]); } m_pTransformCom->Set_WorldMatrix(socketMatrix * XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr())); - - - //_float3 Scale = _float3(10.f, 10.f, 10.f); - //m_pTransformCom->Set_Scale(Scale); } void CWand::Update(_float fTimeDelta) diff --git a/Jusin154_Team3D/Editor/Public/Action_Panel.h b/Jusin154_Team3D/Editor/Public/Action_Panel.h index 685415b08..bce4da7ce 100644 --- a/Jusin154_Team3D/Editor/Public/Action_Panel.h +++ b/Jusin154_Team3D/Editor/Public/Action_Panel.h @@ -3,10 +3,6 @@ #include "Editor_Define.h" #include "PanelObject.h" -NS_BEGIN(Engine) -class CGameObject; -NS_END - NS_BEGIN(Editor) class CAction_Panel final : public CPanelObject @@ -40,6 +36,7 @@ class CAction_Panel final : public CPanelObject CGameObject* m_pSpell_Overlay = { nullptr }; CGameObject* m_pSlot_Number = { nullptr }; CGameObject* m_pHpBarBG= { nullptr }; + CGameObject* m_pMagic_Meter = { nullptr }; public: static CAction_Panel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index 28a421c59..401086d15 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -26,6 +26,7 @@ namespace Editor enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, END }; enum class SHADER_PASS_INSTANCE_MODEL { DEFAULT, NON_NOMALMAP, BLUR, END }; enum class SHADER_PASS_UIEDITOR { DEFAULT, ALPHABLEND, CLAMP, CURSOR, LODING, HOLD_ROTATION, MISSION, QUESTYPE, UVMULT, NINECLICE, ROTATION, SLOT, SPELLTYPE, HPBAR, END }; + enum class SHADER_PASS_UIINTANCE { DEFAULT, ALPHABLEND, MAGIC_METER, END }; enum class EFFECT_TYPE { EFFECT, TRAIL, END }; } diff --git a/Jusin154_Team3D/Editor/Public/Magic_Meter.h b/Jusin154_Team3D/Editor/Public/Magic_Meter.h new file mode 100644 index 000000000..c6960a852 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Magic_Meter.h @@ -0,0 +1,51 @@ +#pragma once + +#include "Editor_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Editor) + +class CMagic_Meter final : public CElementObject +{ +private: + CMagic_Meter(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CMagic_Meter(const CMagic_Meter& rhs); + virtual ~CMagic_Meter() = 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: + void UV(); + _float2 Compute_UVX(_uint Number); + _float2 Compute_UVY(_uint Numver); + + +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 }; + CTexture* m_pDiffuse_TextureCom1 = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_UI_Instance* m_pVIBufferCom = { nullptr }; + CVIBuffer_UI_Instance::UI_ATLAS_DESC pUVDesc[5]; + + _uint m_iCols{}; + _float2 m_fIamge_Size{}; + //_float2 Position[5]; +public: + static CMagic_Meter* 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/Editor/Public/Player.h b/Jusin154_Team3D/Editor/Public/Player.h index c2747a381..a9a42f602 100644 --- a/Jusin154_Team3D/Editor/Public/Player.h +++ b/Jusin154_Team3D/Editor/Public/Player.h @@ -7,13 +7,6 @@ NS_BEGIN(Editor) class CPlayer final : public CUnit { -public: - struct InputCondition - { - FSMSTATE::ESTATE state; - function<_bool()> checker; - }; - private: CPlayer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CPlayer(const CPlayer& Prototype); @@ -31,11 +24,9 @@ class CPlayer final : public CUnit size_t m_iStateMask = { 0 }; _float m_fDirectionRadian = 0.f; - vector m_InputConditions; _bool m_bSprintToggle = { false }; _bool m_bWalkToggle = { false }; - _int m_iCombo = { 0 }; class CCamPosition_Socket* m_pCamPosition_TopDown_LookPart = { nullptr }; class CCamPosition_Arm* m_pCamPosition_TopDown_FollowPart = { nullptr }; @@ -52,6 +43,7 @@ class CPlayer final : public CUnit HRESULT Ready_Parts(); HRESULT Bind_ShaderResources(); + void TestKeyInput(_float fTimeDelta); public: static CPlayer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; @@ -70,6 +62,9 @@ class CPlayer final : public CUnit HRESULT InputAction(); HRESULT InputMove(); + HRESULT InputSpell(); + + STATEANIM::ESTATE m_eSpell = { STATEANIM::END }; void Behavior_IdleEnter(); HRESULT Behavior_IdleExitCheck(); diff --git a/Jusin154_Team3D/Editor/Public/Potion.h b/Jusin154_Team3D/Editor/Public/Potion.h new file mode 100644 index 000000000..604263141 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Potion.h @@ -0,0 +1,40 @@ +#pragma once + +#include "Editor_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Editor) + +class CPotion final : public CElementObject +{ +private: + CPotion(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CPotion(const CPotion& rhs); + virtual ~CPotion() = 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 CPotion* 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/Editor/Public/Spell_Slot_Preview.h b/Jusin154_Team3D/Editor/Public/Spell_Slot_Preview.h new file mode 100644 index 000000000..5fa48e200 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Spell_Slot_Preview.h @@ -0,0 +1,40 @@ +#pragma once + +#include "Editor_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Editor) + +class CSpell_Slot_Preview final : public CElementObject +{ +private: + CSpell_Slot_Preview(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpell_Slot_Preview(const CSpell_Slot_Preview& rhs); + virtual ~CSpell_Slot_Preview() = 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_UI_Instance* m_pVIBufferCom = { nullptr }; + +public: + static CSpell_Slot_Preview* 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/VIBuffer_UI_Instance.cpp b/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp index 452e704f4..627bd6bf4 100644 --- a/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp +++ b/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp @@ -131,6 +131,32 @@ HRESULT CVIBuffer_UI_Instance::Initialize(void* pArg) return S_OK; } +void CVIBuffer_UI_Instance::Set_Index_Position(_uint iIndex, _float fX, _float fY) +{ + D3D11_MAPPED_SUBRESOURCE SubResource{}; + m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &SubResource); + + VTX_INSTANCE_UI* pVertices = static_cast(SubResource.pData); + + pVertices[iIndex].fPos.x = fX; + pVertices[iIndex].fPos.y = fY; + + m_pContext->Unmap(m_pVBInstance, 0); +} + +void CVIBuffer_UI_Instance::Set_Index_Size(_uint iIndex, _float fSizeX, _float fSizeY) +{ + D3D11_MAPPED_SUBRESOURCE SubResource{}; + m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &SubResource); + + VTX_INSTANCE_UI* pVertices = static_cast(SubResource.pData); + + pVertices[iIndex].fSize.x = fSizeX; + pVertices[iIndex].fSize.y = fSizeY; + + m_pContext->Unmap(m_pVBInstance, 0); +} + void CVIBuffer_UI_Instance::Set_Pos(_float fX, _float fY, _float OffSetX, _float OffSetY, _uint iCols) { @@ -213,7 +239,7 @@ void CVIBuffer_UI_Instance::Set_ImageUV(UI_ATLAS_DESC* AtlasUV) if (AtlasUV == nullptr) { pVertices[i].fUVStart = _float2(0.f, 0.f); - pVertices[i].fUVStart = _float2(1.f,1.f); + pVertices[i].fUVStart = _float2(1.f, 1.f); } else { @@ -225,6 +251,25 @@ void CVIBuffer_UI_Instance::Set_ImageUV(UI_ATLAS_DESC* AtlasUV) m_pContext->Unmap(m_pVBInstance, 0); } +void CVIBuffer_UI_Instance::Add_InstanceOvject(vector<_uint> VisileIndices) +{ + m_VisibleIndices = VisileIndices; + D3D11_MAPPED_SUBRESOURCE SubResource{}; + + m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &SubResource); + + VTX_INSTANCE_UI* pVertices = static_cast(SubResource.pData); + + for (_uint i = 0; i < m_VisibleIndices.size(); ++i) + { + pVertices[i] = m_pInstanceVertices[m_VisibleIndices[i]]; + } + + + m_pContext->Unmap(m_pVBInstance, 0); + +} + CVIBuffer_UI_Instance* CVIBuffer_UI_Instance::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const INSTANCE_DESC* pInstanceDesc) { CVIBuffer_UI_Instance* pInstance = new CVIBuffer_UI_Instance(pDevice, pContext); diff --git a/Jusin154_Team3D/Engine/Public/FSM.h b/Jusin154_Team3D/Engine/Public/FSM.h index a233d1cbc..52ae58118 100644 --- a/Jusin154_Team3D/Engine/Public/FSM.h +++ b/Jusin154_Team3D/Engine/Public/FSM.h @@ -14,7 +14,7 @@ enum ESTATE : _u64Flag DODGE = 1ULL << 7, COMBAT = 1ULL << 8, LIGHT_ATTACK = 1ULL << 9, - CAST = 1ULL << 10, + SPELL = 1ULL << 10, SKILL = 1ULL << 11, SKILL2 = 1ULL << 12, MAPHELP = 1ULL << 13, diff --git a/Jusin154_Team3D/Engine/Public/State.h b/Jusin154_Team3D/Engine/Public/State.h index 246971a8d..60a160fe5 100644 --- a/Jusin154_Team3D/Engine/Public/State.h +++ b/Jusin154_Team3D/Engine/Public/State.h @@ -12,7 +12,8 @@ enum ESTATE JUMP,JUMP_JOG,JUMP_SPRINT, LAND, DODGE, - COMBAT, LIGHT_ATTACK, CAST, SKILL, SKILL2, + COMBAT, LIGHT_ATTACK, SPELL, SKILL, SKILL2, + ACCIO,DESCENDO,DIFFINDO,DEPULSO,LUMOS,DISILLUSION_ENTER,DISILLUSION_EXIT, MAPHELP, END }; diff --git a/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h b/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h index 44c73d40f..a484d3a2e 100644 --- a/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h +++ b/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h @@ -25,12 +25,15 @@ class ENGINE_DLL CVIBuffer_UI_Instance final : public CVIBuffer_Instance virtual HRESULT Initialize(void* pArg) override; public: - virtual void Set_Pos(_float fX, _float fY, _float OffSetX, _float OffSetY, _uint iCols); - virtual void Set_Size(_float fSizeX, _float fSizeY); - virtual void Set_SizeX(_float fSizeX); - virtual void Set_SizeY(_float fSizeY); - virtual void Set_Cloned(_bool isCloned) { m_isCloned = isCloned; } - virtual void Set_ImageUV(UI_ATLAS_DESC* AtlasUV = nullptr); + void Set_Index_Position(_uint iIndex, _float fX, _float fY); + void Set_Index_Size(_uint iIndex, _float fSizeX, _float fSizeY); + void Set_Pos(_float fX, _float fY, _float OffSetX, _float OffSetY, _uint iCols); + void Set_Size(_float fSizeX, _float fSizeY); + void Set_SizeX(_float fSizeX); + void Set_SizeY(_float fSizeY); + void Set_Cloned(_bool isCloned) { m_isCloned = isCloned; } + void Set_ImageUV(UI_ATLAS_DESC* AtlasUV = nullptr); + void Add_InstanceOvject(vector<_uint> VisileIndices); private: VTX_INSTANCE_UI* m_pInstanceVertices = { nullptr }; @@ -39,6 +42,8 @@ class ENGINE_DLL CVIBuffer_UI_Instance final : public CVIBuffer_Instance _float2* m_fPosition{ nullptr }; _float m_fAddPosition{}; + vector<_uint> m_VisibleIndices; + public: static CVIBuffer_UI_Instance* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const INSTANCE_DESC* pInstanceDesc); virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;