From 4c681017ab8347f313f05d4e63d04467c911e614 Mon Sep 17 00:00:00 2001 From: hyunbin14 Date: Tue, 18 Nov 2025 22:02:45 +0900 Subject: [PATCH] =?UTF-8?q?[Add]=20=EC=83=81=ED=83=9C=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20[Add]=20=EB=A3=A8=ED=8A=B8=EB=B3=B8=20=ED=9A=8C=EC=A0=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bin/Resources/Models/Human/KeyFrame.bin | 3 - .../Resources/Models/Human/Npc/KeyFrame.bin | 3 + .../Resources/Models/Human/Npc/NFC_Broom.bin | 3 + .../Resources/Models/Human/Npc/Npc_Broom.fbx | 3 + Jusin154_Team3D/Editor/Default/Editor.vcxproj | 8 + .../Editor/Default/Editor.vcxproj.filters | 36 ++++ Jusin154_Team3D/Editor/Private/Broom.cpp | 166 ++++++++++++++++++ .../Editor/Private/DebugCamera.cpp | 1 + Jusin154_Team3D/Editor/Private/Goblin.cpp | 1 + .../Editor/Private/Level_ObjectViewer.cpp | 14 +- Jusin154_Team3D/Editor/Private/Loader.cpp | 6 + Jusin154_Team3D/Editor/Private/Player.cpp | 86 +++++++-- Jusin154_Team3D/Editor/Private/State_Cast.cpp | 18 +- .../Editor/Private/State_Combat.cpp | 14 +- .../Editor/Private/State_Dodge.cpp | 2 +- Jusin154_Team3D/Editor/Private/State_Idle.cpp | 59 +++++-- .../Editor/Private/State_Idle_Turn.cpp | 88 ++++++++++ Jusin154_Team3D/Editor/Private/State_Jog.cpp | 56 ++++++ Jusin154_Team3D/Editor/Private/State_Jump.cpp | 15 +- Jusin154_Team3D/Editor/Private/State_Land.cpp | 2 +- .../Editor/Private/State_LightAttack.cpp | 17 +- Jusin154_Team3D/Editor/Private/State_Move.cpp | 17 +- .../Editor/Private/State_Skill.cpp | 2 +- .../Editor/Private/State_Skill2.cpp | 42 +++++ .../Editor/Private/State_Sprint.cpp | 14 +- Jusin154_Team3D/Editor/Private/State_Walk.cpp | 7 +- Jusin154_Team3D/Editor/Public/Broom.h | 48 +++++ Jusin154_Team3D/Editor/Public/Player.h | 7 +- .../Editor/Public/State_Idle_Turn.h | 21 +++ Jusin154_Team3D/Editor/Public/State_Jog.h | 21 +++ Jusin154_Team3D/Editor/Public/State_Skill2.h | 19 ++ Jusin154_Team3D/Engine/Private/Animation.cpp | 2 +- Jusin154_Team3D/Engine/Private/Channel.cpp | 42 ++++- Jusin154_Team3D/Engine/Private/FSM.cpp | 4 +- Jusin154_Team3D/Engine/Private/Transform.cpp | 26 +++ Jusin154_Team3D/Engine/Private/Unit.cpp | 2 +- Jusin154_Team3D/Engine/Public/Channel.h | 11 +- Jusin154_Team3D/Engine/Public/FSM.h | 5 +- Jusin154_Team3D/Engine/Public/State.h | 16 ++ Jusin154_Team3D/Engine/Public/Transform.h | 1 + Jusin154_Team3D/Engine/Public/Unit.h | 1 + 41 files changed, 826 insertions(+), 83 deletions(-) delete mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/Human/KeyFrame.bin create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/NFC_Broom.bin create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Npc_Broom.fbx create mode 100644 Jusin154_Team3D/Editor/Private/Broom.cpp create mode 100644 Jusin154_Team3D/Editor/Private/State_Idle_Turn.cpp create mode 100644 Jusin154_Team3D/Editor/Private/State_Jog.cpp create mode 100644 Jusin154_Team3D/Editor/Private/State_Skill2.cpp create mode 100644 Jusin154_Team3D/Editor/Public/Broom.h create mode 100644 Jusin154_Team3D/Editor/Public/State_Idle_Turn.h create mode 100644 Jusin154_Team3D/Editor/Public/State_Jog.h create mode 100644 Jusin154_Team3D/Editor/Public/State_Skill2.h diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/KeyFrame.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/KeyFrame.bin deleted file mode 100644 index a19061885..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/KeyFrame.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d32b8b61a6e5ed2b2c1d6472c01c06b85e86dd6edabe007a56990287dd52af18 -size 52 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/KeyFrame.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/KeyFrame.bin index e69de29bb..12f29295b 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/KeyFrame.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/KeyFrame.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f0e6a868bc07861d4cb0e0cd80ab163ac81805701331463b5401bf74c71e86d +size 29 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/NFC_Broom.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/NFC_Broom.bin new file mode 100644 index 000000000..8e9877109 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/NFC_Broom.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:def7cba77513dd9a10ad40cd962fbb0678c343e91d251b748184520b5a94104f +size 12940862 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Npc_Broom.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Npc_Broom.fbx new file mode 100644 index 000000000..f9c6dbc12 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Npc_Broom.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e59bb5c07f3550596b5a4da0dd248027d19bb96bed84a1019849be6f77df174a +size 35534748 diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index c13a4f901..5ed316e18 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -166,6 +166,7 @@ + @@ -225,11 +226,14 @@ + + + @@ -277,6 +281,7 @@ + @@ -336,11 +341,14 @@ + + + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index db22f9b55..c149e7351 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -301,6 +301,18 @@ {b017e167-f48d-4417-a924-765ab802cff5} + + {3614836d-9988-4ec0-95a8-f8ebc25a9a13} + + + {98f012a4-2f13-456f-85ba-6929b1535de6} + + + {3ad2f4c4-95e6-47fa-9f4c-b9fcdbd77277} + + + {a9862861-6eaa-4e04-b7f6-217a32db7db4} + @@ -591,6 +603,18 @@ 80.State\State_Combat + + 80.State\State_Combat\State_Skill2 + + + 80.State\State_Idle\State_Idle_Turn + + + 80.State\State_Move\State_Jog + + + 02.GameObjects\Broom + @@ -877,6 +901,18 @@ 80.State\State_Combat + + 80.State\State_Combat\State_Skill2 + + + 80.State\State_Idle\State_Idle_Turn + + + 80.State\State_Move\State_Jog + + + 02.GameObjects\Broom + diff --git a/Jusin154_Team3D/Editor/Private/Broom.cpp b/Jusin154_Team3D/Editor/Private/Broom.cpp new file mode 100644 index 000000000..24541bd2b --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Broom.cpp @@ -0,0 +1,166 @@ +#include "pch.h" +#include "Broom.h" + +#include "GameInstance.h" + +CBroom::CBroom(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CGameObject(pDevice, pContext) +{ +} + +CBroom::CBroom(const CBroom& Prototype) + : CGameObject(Prototype) +{ +} + +HRESULT CBroom::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CBroom::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + + if (FAILED(Ready_Components())) + return E_FAIL; + + m_pModelCom->Set_AnimationIndex(5); + + return S_OK; +} + +void CBroom::Priority_Update(_float fTimeDelta) +{ +} + +void CBroom::Update(_float fTimeDelta) +{ + m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); +} + +void CBroom::Late_Update(_float fTimeDelta) +{ + m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this); +} + +HRESULT CBroom::Render() +{ + if (!m_pModelCom) + return S_OK; + + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + + _uint iNumMeshes = m_pModelCom->Get_NumMeshes(); + + for (_uint i = 0; i < iNumMeshes; i++) + { + if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) { + return E_FAIL; + } + + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) { + return E_FAIL; + } + if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) { + return E_FAIL; + } + + if (FAILED(m_pModelCom->Render(i))) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CBroom::Ready_Components() +{ + CTransform::TRANSFORM_DESC Desc = {}; + + Desc.fSpeedPerSec = 10.f; + Desc.fRotationPerSec = XMConvertToRadians(180.0f); + Desc.fRadius = 10.f; + + __super::Ready_Components(&Desc); + + /* Com_Model */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Broom_Model"), + reinterpret_cast(&m_pModelCom)))) + return E_FAIL; + + /* Com_Shader */ + if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_ANIMMESH, + reinterpret_cast(&m_pShaderCom)))) + return E_FAIL; + + return S_OK; +} + +HRESULT CBroom::Bind_ShaderResources() +{ + if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) { + return E_FAIL; + } + 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; +} + +CBroom* CBroom::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CBroom* pInstance = new CBroom(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CBroom"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CBroom::Clone(void* pArg, CGameObject* pOwner) +{ + CBroom* pInstance = new CBroom(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CBroom"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CBroom::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pModelCom); + + +} + +void CBroom::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/DebugCamera.cpp b/Jusin154_Team3D/Editor/Private/DebugCamera.cpp index 803bda53a..2952b68c6 100644 --- a/Jusin154_Team3D/Editor/Private/DebugCamera.cpp +++ b/Jusin154_Team3D/Editor/Private/DebugCamera.cpp @@ -18,6 +18,7 @@ void CDebugCamera::Priority_Update(_float fTimeDelta) void CDebugCamera::Update(_float fTimeDelta) { + Transition(fTimeDelta); _float3 vCamPos = {}; XMStoreFloat3(&vCamPos, m_pTransformCom->Get_State(STATE::POSITION)); GUI::Text("Cam Coord %.2f, %.2f, %.2f", vCamPos.x, vCamPos.y, vCamPos.z); diff --git a/Jusin154_Team3D/Editor/Private/Goblin.cpp b/Jusin154_Team3D/Editor/Private/Goblin.cpp index e013c8b73..a444dbf36 100644 --- a/Jusin154_Team3D/Editor/Private/Goblin.cpp +++ b/Jusin154_Team3D/Editor/Private/Goblin.cpp @@ -145,6 +145,7 @@ CGameObject* CGoblin::Clone(void* pArg, CGameObject* pOwner) void CGoblin::Free() { __super::Free(); + } void CGoblin::Describe_Entity() diff --git a/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp index 96c5b8014..2ae091489 100644 --- a/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp @@ -17,7 +17,7 @@ #include "Terrain.h" #include "Player.h" #include "Goblin.h" - +#include "Broom.h" CLevel_ObjectViewer::CLevel_ObjectViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID) : CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) } { @@ -368,9 +368,12 @@ void CLevel_ObjectViewer::Dummy_Object_Setting() GUI::Begin("Object_Info"); if (!m_Objects.empty()) { - _float3 Pos; - XMStoreFloat3(&Pos, m_Objects[m_iObjectIndex]->Get_Component()->Get_State(STATE::POSITION)); - GUI::DragFloat3("Pos", (_float*)&Pos); + _float4 Pos; + XMStoreFloat4(&Pos, m_Objects[m_iObjectIndex]->Get_Component()->Get_State(STATE::POSITION)); + if (GUI::DragFloat3("Pos", (_float*)&Pos)) + { + m_Objects[m_iObjectIndex]->Get_Component()->Set_State(STATE::POSITION, XMLoadFloat4(&Pos)); + } Show_ObjectList(); @@ -700,6 +703,9 @@ 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; + return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 67838c4a6..ed87c6717 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -22,6 +22,7 @@ #include "DummyObject.h" #include "Player.h" #include "Goblin.h" +#include "Broom.h" #include #pragma endregion @@ -1149,6 +1150,11 @@ HRESULT CLoader::Loading_For_ObjectViewer() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin::Create(m_pDevice, m_pContext)))) return E_FAIL; + + /* For.Prototype_GameObject_Broom */ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBroom::Create(m_pDevice, m_pContext)))) + return E_FAIL; + m_strMessage = TEXT("Loading Success!"); m_isFinished = true; diff --git a/Jusin154_Team3D/Editor/Private/Player.cpp b/Jusin154_Team3D/Editor/Private/Player.cpp index 7a97db996..7e4df71e1 100644 --- a/Jusin154_Team3D/Editor/Private/Player.cpp +++ b/Jusin154_Team3D/Editor/Private/Player.cpp @@ -7,15 +7,18 @@ #pragma region STATE #include "State_Idle.h" #include "State_Walk.h" -#include "State_Dodge.h" +#include "State_Jog.h" #include "State_Sprint.h" +#include "State_Dodge.h" #include "State_Jump.h" #include "State_Skill.h" +#include "State_Skill2.h" #include "State_LightAttack.h" #include "State_Land.h" #include "State_Cast.h" #include "State_Move.h" #include "State_Combat.h" +#include "State_Idle_Turn.h" #pragma endregion CPlayer::CPlayer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -155,17 +158,19 @@ void CPlayer::Setup_InputConditions() { m_InputConditions = { - { FSMSTATE::MOVE, [&]() {return Check(FSMSTATE::WALK) && Check(FSMSTATE::SPRINT) && Check(FSMSTATE::JOG); }}, + { FSMSTATE::IDLE_TURN, [&]() { return m_pGameInstance->Key_Down(DIK_LEFT) || m_pGameInstance->Key_Down(DIK_RIGHT) || m_pGameInstance->Key_Down(DIK_DOWN); }}, + { FSMSTATE::MOVE, [&]() { return Check(FSMSTATE::WALK) || Check(FSMSTATE::SPRINT) || Check(FSMSTATE::JOG) || Check(FSMSTATE::DODGE); }}, { FSMSTATE::WALK, [&]() { return m_pGameInstance->Key_Pressing(DIK_UP) - || m_pGameInstance->Key_Pressing(DIK_DOWN); }}, + /*|| m_pGameInstance->Key_Pressing(DIK_DOWN)*/; }}, { FSMSTATE::WALK_FWD, [&]() { return m_pGameInstance->Key_Pressing(DIK_UP); }}, { FSMSTATE::WALK_BWD, [&]() { return m_pGameInstance->Key_Pressing(DIK_DOWN); }}, - { FSMSTATE::SPRINT, [&]() { return m_pGameInstance->Key_Pressing(DIK_LSHIFT) + { FSMSTATE::SPRINT, [&]() { return m_bSprintToggle && m_pGameInstance->Key_Pressing(DIK_UP); }}, - - { FSMSTATE::COMBAT, [&]() {return Check(FSMSTATE::DODGE) && Check(FSMSTATE::SKILL) && Check(FSMSTATE::LIGHT_ATTACK) && Check(FSMSTATE::CAST); }}, { FSMSTATE::DODGE, [&]() { return m_pGameInstance->Key_Down(DIK_LCONTROL); }}, + + { FSMSTATE::COMBAT, [&]() { return Check(FSMSTATE::SKILL) || Check(FSMSTATE::LIGHT_ATTACK) || Check(FSMSTATE::CAST) || Check(FSMSTATE::SKILL2); }}, { FSMSTATE::SKILL, [&]() { return m_pGameInstance->Key_Down(DIK_R); }}, + { FSMSTATE::SKILL2, [&]() { return m_pGameInstance->Key_Down(DIK_Q); }}, { FSMSTATE::LIGHT_ATTACK,[&]() { return m_pGameInstance->Mouse_Up(ENUM_CLASS(MOUSEKEYSTATE::LBUTTON)); }}, { FSMSTATE::CAST, [&]() { return m_pGameInstance->Key_Down(DIK_1); }}, @@ -185,6 +190,8 @@ void CPlayer::Key_Input(_float fTimeDelta) if (m_pGameInstance->Key_Pressing(DIK_RIGHT)) m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta); } + + IsSprint(); } void CPlayer::Add_FSM() @@ -192,17 +199,20 @@ void CPlayer::Add_FSM() #pragma region MOVE m_pFSM->Add_State(FSMSTATE::MOVE, new CState_Move()); m_pFSM->Add_State(FSMSTATE::WALK, new CState_Walk()); + m_pFSM->Add_State(FSMSTATE::JOG, new CState_Jog()); m_pFSM->Add_State(FSMSTATE::SPRINT, new CState_Sprint()); + m_pFSM->Add_State(FSMSTATE::DODGE, new CState_Dodge()); #pragma endregion #pragma region COMBAT m_pFSM->Add_State(FSMSTATE::COMBAT, new CState_Combat()); m_pFSM->Add_State(FSMSTATE::SKILL, new CState_Skill()); + m_pFSM->Add_State(FSMSTATE::SKILL2, new CState_Skill2()); m_pFSM->Add_State(FSMSTATE::LIGHT_ATTACK, new CState_LightAttack()); m_pFSM->Add_State(FSMSTATE::CAST, new CState_Cast()); - m_pFSM->Add_State(FSMSTATE::DODGE, new CState_Dodge()); #pragma endregion m_pFSM->Add_State(FSMSTATE::IDLE, new CState_Idle()); + m_pFSM->Add_State(FSMSTATE::IDLE_TURN, new CState_Idle_Turn()); m_pFSM->Add_State(FSMSTATE::JUMP, new CState_Jump()); m_pFSM->Add_State(FSMSTATE::LAND, new CState_Land()); @@ -216,28 +226,44 @@ void CPlayer::Set_FSM() m_pFSM->Set_Parent(FSMSTATE::WALK_FWD, FSMSTATE::MOVE); m_pFSM->Set_Parent(FSMSTATE::JOG, FSMSTATE::MOVE); m_pFSM->Set_Parent(FSMSTATE::SPRINT, FSMSTATE::MOVE); + m_pFSM->Set_Parent(FSMSTATE::DODGE, FSMSTATE::MOVE); #pragma endregion #pragma region COMBAT m_pFSM->Set_Parent(FSMSTATE::SKILL, FSMSTATE::COMBAT); + m_pFSM->Set_Parent(FSMSTATE::SKILL2, FSMSTATE::COMBAT); m_pFSM->Set_Parent(FSMSTATE::LIGHT_ATTACK, FSMSTATE::COMBAT); m_pFSM->Set_Parent(FSMSTATE::CAST, FSMSTATE::COMBAT); - m_pFSM->Set_Parent(FSMSTATE::DODGE, FSMSTATE::COMBAT); #pragma endregion } void CPlayer::Set_Anim() { - m_Animation[FSMSTATE::IDLE] = { 266,true }; - m_Animation[FSMSTATE::DODGE] = { 802,false }; - m_Animation[FSMSTATE::WALK_FWD] = { 167,true }; - m_Animation[FSMSTATE::WALK_BWD] = { 166,true }; - m_Animation[FSMSTATE::SPRINT] = { 599,true }; - m_Animation[FSMSTATE::JUMP] = { 205,false }; - m_Animation[FSMSTATE::SKILL] = { 593,false }; - m_Animation[FSMSTATE::LIGHT_ATTACK] = { 413,false }; - m_Animation[FSMSTATE::LAND] = { 259,false }; - m_Animation[FSMSTATE::CAST] = { 696,false }; + + m_Animation[STATEANIM::DODGE] = { 802,false }; + + m_Animation[STATEANIM::JOG] = { 166,true }; + + m_Animation[STATEANIM::SKILL] = { 593,false }; + m_Animation[STATEANIM::SKILL2] = { 915,false }; + m_Animation[STATEANIM::LIGHT_ATTACK] = { 413,false }; + m_Animation[STATEANIM::LAND] = { 259,false }; + m_Animation[STATEANIM::CAST] = { 696,false }; + + 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] = { 167,true }; + m_Animation[STATEANIM::WALK_BWD] = { 166,true }; + m_Animation[STATEANIM::WALK_STOP] = { 289,false }; + + m_Animation[STATEANIM::JUMP] = { 205,false }; + m_Animation[STATEANIM::JUMP_WALK] = { 203,false }; + m_Animation[STATEANIM::JUMP_SPRINT] = { 207,false }; + + m_Animation[STATEANIM::SPRINT] = { 599,true }; } CPlayer* CPlayer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -279,6 +305,21 @@ void CPlayer::Describe_Entity() GUI::Text(label); } + _float3 Pos; + XMStoreFloat3(&Pos, Get_WorldPostion()); + + float Pos3[3] = { Pos.x, Pos.y, Pos.z }; + GUI::DragFloat3("Pos", Pos3); + + + _float RotR,RotU,RotL; + RotR = XMVectorGetX(m_pTransformCom->Get_State(STATE::RIGHT)); + RotU = XMVectorGetY(m_pTransformCom->Get_State(STATE::UP)); + RotL = XMVectorGetZ(m_pTransformCom->Get_State(STATE::LOOK)); + + float Rot3[3] = { RotR, RotU,RotL }; + GUI::DragFloat3("Rot", Rot3); + } _bool CPlayer::Check(FSMSTATE::ESTATE state) @@ -290,3 +331,12 @@ _bool CPlayer::Check(FSMSTATE::ESTATE state) } return false; } + +_bool CPlayer::IsSprint() +{ + if (m_pGameInstance->Key_Down(DIK_LSHIFT)) + { + return m_bSprintToggle = !m_bSprintToggle; + } + return false; +} diff --git a/Jusin154_Team3D/Editor/Private/State_Cast.cpp b/Jusin154_Team3D/Editor/Private/State_Cast.cpp index f736fab28..3915da0eb 100644 --- a/Jusin154_Team3D/Editor/Private/State_Cast.cpp +++ b/Jusin154_Team3D/Editor/Private/State_Cast.cpp @@ -13,7 +13,7 @@ void CState_Cast::Enter() if (m_pFSM->Get_PrevState() == FSMSTATE::CAST) return; - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::CAST); + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::CAST); m_pModel->Set_AnimationIndex(anim.first, anim.second); } @@ -29,13 +29,6 @@ void CState_Cast::Exit() _bool CState_Cast::CheckExitState() { - if (m_pOwner->Check(FSMSTATE::WALK)) - { - m_pOwner->Reset_LightCombo(); - m_pFSM->Change_State(FSMSTATE::WALK); - return true; - } - if (m_pModel->IsFinishedAnim()) { m_pOwner->Reset_LightCombo(); @@ -54,7 +47,7 @@ _bool CState_Cast::CheckExitState() return true; } - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::CAST); + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::CAST); m_pModel->Set_AnimationIndex(anim.first + combo, anim.second); m_pFSM->Change_State(FSMSTATE::CAST); @@ -62,6 +55,13 @@ _bool CState_Cast::CheckExitState() return true; } + if (m_pOwner->Check(FSMSTATE::SKILL2)) + { + m_pOwner->Reset_LightCombo(); + m_pFSM->Change_State(FSMSTATE::SKILL2); + return true; + } + return false; } diff --git a/Jusin154_Team3D/Editor/Private/State_Combat.cpp b/Jusin154_Team3D/Editor/Private/State_Combat.cpp index 616dec433..932fe1f57 100644 --- a/Jusin154_Team3D/Editor/Private/State_Combat.cpp +++ b/Jusin154_Team3D/Editor/Private/State_Combat.cpp @@ -25,11 +25,23 @@ void CState_Combat::Exit() _bool CState_Combat::CheckExitState() { - if (m_pOwner->Check(FSMSTATE::MOVE)) + if (m_pOwner->Check(FSMSTATE::MOVE) && + !m_pOwner->Check(FSMSTATE::COMBAT)) { m_pFSM->Change_State(FSMSTATE::MOVE); + + if (m_pOwner->Check(FSMSTATE::WALK)) + m_pFSM->Change_State(FSMSTATE::WALK); + + if (m_pOwner->Check(FSMSTATE::SPRINT)) + m_pFSM->Change_State(FSMSTATE::SPRINT); + + if (m_pOwner->Check(FSMSTATE::DODGE)) + m_pFSM->Change_State(FSMSTATE::DODGE); + return true; } + return false; } diff --git a/Jusin154_Team3D/Editor/Private/State_Dodge.cpp b/Jusin154_Team3D/Editor/Private/State_Dodge.cpp index 53925868c..e2052ad0b 100644 --- a/Jusin154_Team3D/Editor/Private/State_Dodge.cpp +++ b/Jusin154_Team3D/Editor/Private/State_Dodge.cpp @@ -10,7 +10,7 @@ CState_Dodge::CState_Dodge() void CState_Dodge::Enter() { - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::DODGE); + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::DODGE); m_pModel->Set_AnimationIndex(anim.first, anim.second); } diff --git a/Jusin154_Team3D/Editor/Private/State_Idle.cpp b/Jusin154_Team3D/Editor/Private/State_Idle.cpp index c66342a9d..fc24940e1 100644 --- a/Jusin154_Team3D/Editor/Private/State_Idle.cpp +++ b/Jusin154_Team3D/Editor/Private/State_Idle.cpp @@ -9,8 +9,17 @@ CState_Idle::CState_Idle() void CState_Idle::Enter() { - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::IDLE); - m_pModel->Set_AnimationIndex(anim.first, anim.second); + if (m_pFSM->Get_PrevState() == FSMSTATE::WALK) + { + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_STOP); + m_pModel->Set_AnimationIndex(anim.first, anim.second); + return; + } + else + { + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::IDLE); + m_pModel->Set_AnimationIndex(anim.first, anim.second); + } } void CState_Idle::Update(_float fTimeDelta) @@ -25,27 +34,43 @@ void CState_Idle::Exit() _bool CState_Idle::CheckExitState() { - if (m_pOwner->Check(FSMSTATE::WALK)) - m_pFSM->Change_State(FSMSTATE::WALK); + if (m_pOwner->Check(FSMSTATE::MOVE)) + { + m_pFSM->Change_State(FSMSTATE::MOVE); - if (m_pOwner->Check(FSMSTATE::DODGE)) - m_pFSM->Change_State(FSMSTATE::DODGE); + if (m_pOwner->Check(FSMSTATE::WALK)) + m_pFSM->Change_State(FSMSTATE::WALK); - if (m_pOwner->Check(FSMSTATE::SPRINT)) - m_pFSM->Change_State(FSMSTATE::SPRINT); + if (m_pOwner->Check(FSMSTATE::SPRINT)) + m_pFSM->Change_State(FSMSTATE::SPRINT); + + if (m_pOwner->Check(FSMSTATE::DODGE)) + m_pFSM->Change_State(FSMSTATE::DODGE); + } + + if (m_pOwner->Check(FSMSTATE::COMBAT)) + { + m_pFSM->Change_State(FSMSTATE::COMBAT); + + if (m_pOwner->Check(FSMSTATE::SKILL)) + m_pFSM->Change_State(FSMSTATE::SKILL); + + if (m_pOwner->Check(FSMSTATE::SKILL2)) + m_pFSM->Change_State(FSMSTATE::SKILL2); + + if (m_pOwner->Check(FSMSTATE::LIGHT_ATTACK)) + m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK); + + if (m_pOwner->Check(FSMSTATE::CAST)) + m_pFSM->Change_State(FSMSTATE::CAST); + } + + if (m_pOwner->Check(FSMSTATE::IDLE_TURN)) + m_pFSM->Change_State(FSMSTATE::IDLE_TURN); if (m_pOwner->Check(FSMSTATE::JUMP)) m_pFSM->Change_State(FSMSTATE::JUMP); - if (m_pOwner->Check(FSMSTATE::SKILL)) - m_pFSM->Change_State(FSMSTATE::SKILL); - - if (m_pOwner->Check(FSMSTATE::LIGHT_ATTACK)) - m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK); - - if (m_pOwner->Check(FSMSTATE::CAST)) - m_pFSM->Change_State(FSMSTATE::CAST); - return false; } diff --git a/Jusin154_Team3D/Editor/Private/State_Idle_Turn.cpp b/Jusin154_Team3D/Editor/Private/State_Idle_Turn.cpp new file mode 100644 index 000000000..d0b9f1712 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/State_Idle_Turn.cpp @@ -0,0 +1,88 @@ +#include "pch.h" +#include "State_Idle_Turn.h" +#include "Unit.h" + +CState_Idle_Turn::CState_Idle_Turn() + :CState() +{ +} + +void CState_Idle_Turn::Enter() +{ + if (m_pGameInstance->Key_Down(DIK_LEFT)) + { + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::IDLE_TURN_L); + m_pModel->Set_AnimationIndex(anim.first, anim.second); + } + if (m_pGameInstance->Key_Down(DIK_RIGHT)) + { + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::IDLE_TURN_R); + m_pModel->Set_AnimationIndex(anim.first, anim.second); + } + if (m_pGameInstance->Key_Down(DIK_DOWN)) + { + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::IDLE_TURN_BWD); + m_pModel->Set_AnimationIndex(anim.first, anim.second); + } +} + +void CState_Idle_Turn::Update(_float fTimeDelta) +{ + if (CheckExitState()) + return; +} + +void CState_Idle_Turn::Exit() +{ +} + +_bool CState_Idle_Turn::CheckExitState() +{ + if (m_pOwner->Check(FSMSTATE::MOVE)) + { + m_pFSM->Change_State(FSMSTATE::MOVE); + + if (m_pOwner->Check(FSMSTATE::WALK)) + m_pFSM->Change_State(FSMSTATE::WALK); + + if (m_pOwner->Check(FSMSTATE::SPRINT)) + m_pFSM->Change_State(FSMSTATE::SPRINT); + + if (m_pOwner->Check(FSMSTATE::DODGE)) + m_pFSM->Change_State(FSMSTATE::DODGE); + } + + if (m_pOwner->Check(FSMSTATE::COMBAT)) + { + m_pFSM->Change_State(FSMSTATE::COMBAT); + + if (m_pOwner->Check(FSMSTATE::SKILL)) + m_pFSM->Change_State(FSMSTATE::SKILL); + + if (m_pOwner->Check(FSMSTATE::SKILL2)) + m_pFSM->Change_State(FSMSTATE::SKILL2); + + if (m_pOwner->Check(FSMSTATE::LIGHT_ATTACK)) + m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK); + + if (m_pOwner->Check(FSMSTATE::CAST)) + m_pFSM->Change_State(FSMSTATE::CAST); + } + + if (m_pModel->IsFinishedAnim()) + m_pFSM->Change_State(FSMSTATE::IDLE); + + if (m_pOwner->Check(FSMSTATE::JUMP)) + m_pFSM->Change_State(FSMSTATE::JUMP); + + return false; +} + +void CState_Idle_Turn::Free() +{ + __super::Free(); +} + +void CState_Idle_Turn::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/State_Jog.cpp b/Jusin154_Team3D/Editor/Private/State_Jog.cpp new file mode 100644 index 000000000..3831f9943 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/State_Jog.cpp @@ -0,0 +1,56 @@ +#include "pch.h" +#include "State_Jog.h" +#include "Unit.h" + +CState_Jog::CState_Jog() + :CState() +{ +} + +void CState_Jog::Enter() +{ + if (m_pOwner->Check(FSMSTATE::WALK_FWD)) + { + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_FWD); + m_pModel->Set_AnimationIndex(anim.first, anim.second); + } + + if (m_pOwner->Check(FSMSTATE::WALK_BWD)) + { + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_BWD); + m_pModel->Set_AnimationIndex(anim.first, anim.second); + } +} + +void CState_Jog::Update(_float fTimeDelta) +{ + if (CheckExitState()) + return; +} + +void CState_Jog::Exit() +{ +} + +_bool CState_Jog::CheckExitState() +{ + if (m_pOwner->Check(FSMSTATE::SPRINT)) + m_pFSM->Change_State(FSMSTATE::SPRINT); + + else if (m_pOwner->Check(FSMSTATE::DODGE)) + m_pFSM->Change_State(FSMSTATE::DODGE); + + else if (!m_pOwner->Check(FSMSTATE::JOG)) + m_pFSM->Change_State(FSMSTATE::IDLE); + + return false; +} + +void CState_Jog::Free() +{ + __super::Free(); +} + +void CState_Jog::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/State_Jump.cpp b/Jusin154_Team3D/Editor/Private/State_Jump.cpp index dd4b58487..c2c175863 100644 --- a/Jusin154_Team3D/Editor/Private/State_Jump.cpp +++ b/Jusin154_Team3D/Editor/Private/State_Jump.cpp @@ -10,7 +10,20 @@ CState_Jump::CState_Jump() void CState_Jump::Enter() { - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::JUMP); + if (m_pOwner->Check(FSMSTATE::SPRINT)) + { + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::JUMP_SPRINT); + m_pModel->Set_AnimationIndex(anim.first, anim.second); + return; + } + if (m_pOwner->Check(FSMSTATE::WALK)) + { + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::JUMP_WALK); + m_pModel->Set_AnimationIndex(anim.first, anim.second); + return; + } + + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::JUMP); m_pModel->Set_AnimationIndex(anim.first, anim.second); } diff --git a/Jusin154_Team3D/Editor/Private/State_Land.cpp b/Jusin154_Team3D/Editor/Private/State_Land.cpp index 86ff832d0..d6fb4ea3c 100644 --- a/Jusin154_Team3D/Editor/Private/State_Land.cpp +++ b/Jusin154_Team3D/Editor/Private/State_Land.cpp @@ -10,7 +10,7 @@ CState_Land::CState_Land() void CState_Land::Enter() { - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::LAND); + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::LAND); m_pModel->Set_AnimationIndex(anim.first, anim.second); } diff --git a/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp b/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp index bed197938..ed27639b4 100644 --- a/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp +++ b/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp @@ -13,7 +13,7 @@ void CState_LightAttack::Enter() if (m_pFSM->Get_PrevState() == FSMSTATE::LIGHT_ATTACK) return; - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::LIGHT_ATTACK); + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::LIGHT_ATTACK); m_pModel->Set_AnimationIndex(anim.first, anim.second); } @@ -29,12 +29,6 @@ void CState_LightAttack::Exit() _bool CState_LightAttack::CheckExitState() { - if (m_pOwner->Check(FSMSTATE::WALK)) - { - m_pOwner->Reset_LightCombo(); - m_pFSM->Change_State(FSMSTATE::WALK); - return true; - } if (m_pModel->IsFinishedAnim()) { m_pOwner->Reset_LightCombo(); @@ -53,7 +47,7 @@ _bool CState_LightAttack::CheckExitState() return true; } - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::LIGHT_ATTACK); + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::LIGHT_ATTACK); m_pModel->Set_AnimationIndex(anim.first + combo, anim.second); m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK); @@ -62,6 +56,13 @@ _bool CState_LightAttack::CheckExitState() } + if (m_pOwner->Check(FSMSTATE::SKILL2)) + { + m_pOwner->Reset_LightCombo(); + m_pFSM->Change_State(FSMSTATE::SKILL2); + return true; + } + return false; } diff --git a/Jusin154_Team3D/Editor/Private/State_Move.cpp b/Jusin154_Team3D/Editor/Private/State_Move.cpp index 8b9956607..351df59db 100644 --- a/Jusin154_Team3D/Editor/Private/State_Move.cpp +++ b/Jusin154_Team3D/Editor/Private/State_Move.cpp @@ -25,11 +25,26 @@ void CState_Move::Exit() _bool CState_Move::CheckExitState() { - if (m_pOwner->Check(FSMSTATE::COMBAT)) + if (m_pOwner->Check(FSMSTATE::COMBAT) && + !m_pOwner->Check(FSMSTATE::MOVE)) { m_pFSM->Change_State(FSMSTATE::COMBAT); + + if (m_pOwner->Check(FSMSTATE::SKILL)) + m_pFSM->Change_State(FSMSTATE::SKILL); + + if (m_pOwner->Check(FSMSTATE::SKILL2)) + m_pFSM->Change_State(FSMSTATE::SKILL2); + + if (m_pOwner->Check(FSMSTATE::LIGHT_ATTACK)) + m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK); + + if (m_pOwner->Check(FSMSTATE::CAST)) + m_pFSM->Change_State(FSMSTATE::CAST); + return true; } + return false; } diff --git a/Jusin154_Team3D/Editor/Private/State_Skill.cpp b/Jusin154_Team3D/Editor/Private/State_Skill.cpp index 6b0e9e175..d842e203d 100644 --- a/Jusin154_Team3D/Editor/Private/State_Skill.cpp +++ b/Jusin154_Team3D/Editor/Private/State_Skill.cpp @@ -10,7 +10,7 @@ CState_Skill::CState_Skill() void CState_Skill::Enter() { - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::SKILL); + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::SKILL); m_pModel->Set_AnimationIndex(anim.first, anim.second); } diff --git a/Jusin154_Team3D/Editor/Private/State_Skill2.cpp b/Jusin154_Team3D/Editor/Private/State_Skill2.cpp new file mode 100644 index 000000000..03704ac90 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/State_Skill2.cpp @@ -0,0 +1,42 @@ +#include "pch.h" +#include "State_Skill2.h" +#include "Unit.h" + + +CState_Skill2::CState_Skill2() + :CState() +{ +} + +void CState_Skill2::Enter() +{ + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::SKILL2); + m_pModel->Set_AnimationIndex(anim.first, anim.second); +} + +void CState_Skill2::Update(_float fTimeDelta) +{ + if (CheckExitState()) + return; +} + +void CState_Skill2::Exit() +{ +} + +_bool CState_Skill2::CheckExitState() +{ + if (m_pModel->IsFinishedAnim()) + m_pFSM->Change_State(FSMSTATE::IDLE); + + return false; +} + +void CState_Skill2::Free() +{ + __super::Free(); +} + +void CState_Skill2::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/State_Sprint.cpp b/Jusin154_Team3D/Editor/Private/State_Sprint.cpp index e279f6fc8..eccc2dd30 100644 --- a/Jusin154_Team3D/Editor/Private/State_Sprint.cpp +++ b/Jusin154_Team3D/Editor/Private/State_Sprint.cpp @@ -9,7 +9,7 @@ CState_Sprint::CState_Sprint() void CState_Sprint::Enter() { - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::SPRINT); + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::SPRINT); m_pModel->Set_AnimationIndex(anim.first, anim.second); } @@ -27,10 +27,16 @@ void CState_Sprint::Exit() _bool CState_Sprint::CheckExitState() { if (!m_pOwner->Check(FSMSTATE::SPRINT)) + { + m_pOwner->Reset_Sprint(); m_pFSM->Change_State(FSMSTATE::WALK); - - else if (!m_pOwner->Check(FSMSTATE::WALK)) - m_pFSM->Change_State(FSMSTATE::IDLE); + } + + else if (m_pOwner->Check(FSMSTATE::DODGE)) + m_pFSM->Change_State(FSMSTATE::DODGE); + + if (m_pOwner->Check(FSMSTATE::JUMP)) + m_pFSM->Change_State(FSMSTATE::JUMP); return false; } diff --git a/Jusin154_Team3D/Editor/Private/State_Walk.cpp b/Jusin154_Team3D/Editor/Private/State_Walk.cpp index 104be8f59..967bbbeba 100644 --- a/Jusin154_Team3D/Editor/Private/State_Walk.cpp +++ b/Jusin154_Team3D/Editor/Private/State_Walk.cpp @@ -11,13 +11,13 @@ void CState_Walk::Enter() { if(m_pOwner->Check(FSMSTATE::WALK_FWD)) { - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::WALK_FWD); + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_FWD); m_pModel->Set_AnimationIndex(anim.first, anim.second); } if (m_pOwner->Check(FSMSTATE::WALK_BWD)) { - auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::WALK_BWD); + auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_BWD); m_pModel->Set_AnimationIndex(anim.first, anim.second); } } @@ -43,6 +43,9 @@ _bool CState_Walk::CheckExitState() else if (!m_pOwner->Check(FSMSTATE::WALK)) m_pFSM->Change_State(FSMSTATE::IDLE); + if (m_pOwner->Check(FSMSTATE::JUMP)) + m_pFSM->Change_State(FSMSTATE::JUMP); + return false; } diff --git a/Jusin154_Team3D/Editor/Public/Broom.h b/Jusin154_Team3D/Editor/Public/Broom.h new file mode 100644 index 000000000..caebcc248 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Broom.h @@ -0,0 +1,48 @@ +#pragma once + +#include "Editor_Define.h" +#include "PartObject.h" + +NS_BEGIN(Engine) +class CShader; +class CModel; +NS_END + +NS_BEGIN(Editor) + +class CBroom final : public CGameObject +{ +private: + CBroom(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CBroom(const CBroom& Prototype); + virtual ~CBroom() = default; + +public: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; + +private: + CShader* m_pShaderCom = { nullptr }; + CModel* m_pModelCom = { nullptr }; + + _bool m_bRimLight = { true }; + _float m_fRimLightPower = { 3.2f }; + _float m_fRimLightStrength = { 3.04f }; + _float3 m_vRimLightColor = { 69.f / 255.f, 5.f / 255.f, 10.f / 255.f }; + +private: + HRESULT Ready_Components(); + HRESULT Bind_ShaderResources(); + +public: + static CBroom* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override; + virtual void Free() override; + virtual void Describe_Entity() override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Player.h b/Jusin154_Team3D/Editor/Public/Player.h index 3f33274d5..66b3edc6c 100644 --- a/Jusin154_Team3D/Editor/Public/Player.h +++ b/Jusin154_Team3D/Editor/Public/Player.h @@ -26,9 +26,10 @@ class CPlayer final : public CUnit virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; - + _bool Set_Sprint(_bool bSprint) { m_bSprintToggle = bSprint; } private: vector m_InputConditions; + _bool m_bSprintToggle = { false }; private: HRESULT Ready_Components(); @@ -48,7 +49,9 @@ class CPlayer final : public CUnit virtual void Set_FSM(); virtual void Set_Anim(); _bool Check(FSMSTATE::ESTATE state); - + _bool IsSprint(); +public: + virtual void Reset_Sprint() { m_bSprintToggle = false; } #pragma endregion diff --git a/Jusin154_Team3D/Editor/Public/State_Idle_Turn.h b/Jusin154_Team3D/Editor/Public/State_Idle_Turn.h new file mode 100644 index 000000000..c39f90ee8 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/State_Idle_Turn.h @@ -0,0 +1,21 @@ +#pragma once +#include "Editor_Define.h" +#include "State.h" + +class CState_Idle_Turn final : public CState +{ +public: + CState_Idle_Turn(); + virtual ~CState_Idle_Turn() = default; + +public: + virtual void Enter(); + virtual void Update(_float fTimeDelta); + virtual void Exit(); + virtual _bool CheckExitState(); + +public: + virtual void Free() override; + virtual void Describe_Entity(); +}; + diff --git a/Jusin154_Team3D/Editor/Public/State_Jog.h b/Jusin154_Team3D/Editor/Public/State_Jog.h new file mode 100644 index 000000000..5fa7c5008 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/State_Jog.h @@ -0,0 +1,21 @@ +#pragma once +#include "Editor_Define.h" +#include "State.h" + + +class CState_Jog final : public CState +{ +public: + CState_Jog(); + virtual ~CState_Jog() = default; + +public: + virtual void Enter(); + virtual void Update(_float fTimeDelta); + virtual void Exit(); + virtual _bool CheckExitState(); + +public: + virtual void Free() override; + virtual void Describe_Entity(); +}; diff --git a/Jusin154_Team3D/Editor/Public/State_Skill2.h b/Jusin154_Team3D/Editor/Public/State_Skill2.h new file mode 100644 index 000000000..652630d4b --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/State_Skill2.h @@ -0,0 +1,19 @@ +#pragma once +#include "Editor_Define.h" +#include "State.h" + +class CState_Skill2 final : public CState +{ +public: + CState_Skill2(); + virtual ~CState_Skill2() = default; + +public: + virtual void Enter(); + virtual void Update(_float fTimeDelta); + virtual void Exit(); + virtual _bool CheckExitState(); +public: + virtual void Free() override; + virtual void Describe_Entity(); +}; diff --git a/Jusin154_Team3D/Engine/Private/Animation.cpp b/Jusin154_Team3D/Engine/Private/Animation.cpp index 9d4d13f26..91a1376ef 100644 --- a/Jusin154_Team3D/Engine/Private/Animation.cpp +++ b/Jusin154_Team3D/Engine/Private/Animation.cpp @@ -169,7 +169,7 @@ void CAnimation::InterpAnim(CAnimation* pPreAnim, vector& Bones, float f if (BoneName == "Reference") { - FinalPos = XMVectorZero(); + //FinalPos = XMVectorZero(); } _matrix FinalMat = XMMatrixAffineTransformation(FinalScale, XMVectorZero(), FinalRot, FinalPos); diff --git a/Jusin154_Team3D/Engine/Private/Channel.cpp b/Jusin154_Team3D/Engine/Private/Channel.cpp index 1f72faa3b..bc1043d15 100644 --- a/Jusin154_Team3D/Engine/Private/Channel.cpp +++ b/Jusin154_Team3D/Engine/Private/Channel.cpp @@ -164,7 +164,7 @@ void CChannel::Update_TransformationMatirx(const vector& Bones, _float f _float dy = XMVectorGetY(vDeltaAdjusted); _float dz = XMVectorGetZ(vDeltaAdjusted); - _vector vDeltaWorld = vRight * dx + (-vUp * dz) + vLook * dy; + _vector vDeltaWorld = vRight * dx + (-vUp * dz) + vLook * dy; vDeltaWorld *= 0.01f; @@ -175,6 +175,45 @@ void CChannel::Update_TransformationMatirx(const vector& Bones, _float f m_vPrevRootPos = vCurRootPos; vTranslation = XMVectorZero(); + + ///////////////////////////////////// + + _float4 curRotF4; + XMStoreFloat4(&curRotF4, vRotation); + _vector qCur = XMLoadFloat4(&curRotF4); + + if (!m_bInitialRootRotSaved) + { + m_vInitialRootRot = curRotF4; + m_vPrevRootRot = curRotF4; + m_bInitialRootRotSaved = true; + } + else + { + _vector qPrev = XMLoadFloat4(&m_vPrevRootRot); + + _vector qInvPrev = XMQuaternionInverse(qPrev); + _vector qDelta = XMQuaternionMultiply(qInvPrev, qCur); + + _vector axisLocal; + _float angle = 0.f; + XMQuaternionToAxisAngle(&axisLocal, &angle, qDelta); + + _vector axisWorld = XMVector3TransformNormal(axisLocal, pre); + axisWorld = XMVector3Normalize(axisWorld); + + _float4 axis; + XMStoreFloat4(&axis, axisWorld); + swap(axis.z, axis.y); + + + if (angle > 0 ) + pTransform->TurnAngle(XMLoadFloat4(&axis), -angle); + } + + XMStoreFloat4(&m_vPrevRootRot, qCur); + + vRotation = XMLoadFloat4(&m_vInitialRootRot); } m_BoneTransformationMatrix = XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation); @@ -182,7 +221,6 @@ void CChannel::Update_TransformationMatirx(const vector& Bones, _float f Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix); } - KEYFRAME* CChannel::Get_Frame(_uint iIndex) { return &m_KeyFrames[iIndex]; diff --git a/Jusin154_Team3D/Engine/Private/FSM.cpp b/Jusin154_Team3D/Engine/Private/FSM.cpp index f17e7dde1..f09d5d689 100644 --- a/Jusin154_Team3D/Engine/Private/FSM.cpp +++ b/Jusin154_Team3D/Engine/Private/FSM.cpp @@ -69,7 +69,9 @@ _uint CFSM::Get_CurrState() _uint CFSM::Get_PrevState() { - return m_pPrevious->Get_State(); + if (m_pPrevious) + return m_pPrevious->Get_State(); + return 0; } void CFSM::Set_Parent(FSMSTATE::ESTATE Child, FSMSTATE::ESTATE Parent) diff --git a/Jusin154_Team3D/Engine/Private/Transform.cpp b/Jusin154_Team3D/Engine/Private/Transform.cpp index b6fe733ca..0585b946c 100644 --- a/Jusin154_Team3D/Engine/Private/Transform.cpp +++ b/Jusin154_Team3D/Engine/Private/Transform.cpp @@ -225,6 +225,32 @@ void CTransform::Turn(_fvector vAxis, _float fTimeDelta) Set_State(STATE::LOOK, vLook); } +void CTransform::TurnAngle(_vector vAxis, _float fAngle) +{ + _vector vRight = Get_State(STATE::RIGHT); + _vector vUp = Get_State(STATE::UP); + _vector vLook = Get_State(STATE::LOOK); + if (vAxis.m128_f32[0] == 0) + return; + if (vAxis.m128_f32[1] == 0) + return; + if (vAxis.m128_f32[2] == 0) + return; + + vAxis = XMVector3Normalize(vAxis); + + _matrix TurnMatrix = XMMatrixRotationAxis(vAxis, fAngle); + + vRight = XMVector3TransformNormal(vRight, TurnMatrix); + vUp = XMVector3TransformNormal(vUp, TurnMatrix); + vLook = XMVector3TransformNormal(vLook, TurnMatrix); + + Set_State(STATE::RIGHT, vRight); + Set_State(STATE::UP, vUp); + Set_State(STATE::LOOK, vLook); +} + + void CTransform::Rotation(_fvector vAxis, _float fRadian) { _float3 vScale = Get_Scale(); diff --git a/Jusin154_Team3D/Engine/Private/Unit.cpp b/Jusin154_Team3D/Engine/Private/Unit.cpp index c916579ef..1d4672861 100644 --- a/Jusin154_Team3D/Engine/Private/Unit.cpp +++ b/Jusin154_Team3D/Engine/Private/Unit.cpp @@ -23,7 +23,7 @@ HRESULT CUnit::Initialize(void* pArg) if (FAILED(__super::Initialize(pArg))) return E_FAIL; - m_Animation.resize(FSMSTATE::END); + m_Animation.resize(STATEANIM::END); return S_OK; } diff --git a/Jusin154_Team3D/Engine/Public/Channel.h b/Jusin154_Team3D/Engine/Public/Channel.h index 9a5590477..745a95f1c 100644 --- a/Jusin154_Team3D/Engine/Public/Channel.h +++ b/Jusin154_Team3D/Engine/Public/Channel.h @@ -22,7 +22,11 @@ class ENGINE_DLL CChannel : public CBase void Update_TransformationMatirx(const vector& Bones, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex,class CTransform* pTransform=nullptr); _int Get_BoneIndex() { return { m_iBoneIndex }; } void Set_BoneIndex(_int iBoneIndex) { m_iBoneIndex = iBoneIndex; } - void ResetRootMotion() { m_vPrevRootPos = { 0.f, 0.f, 0.f }; } + void ResetRootMotion() { + m_vPrevRootPos = { 0.f, 0.f, 0.f }; + m_vPrevRootRot = { 0.f,0.f,0.f,0.f }; + m_bInitialRootRotSaved = false; + } _matrix Get_BoneTransformationMatrix() { return m_BoneTransformationMatrix; } KEYFRAME* Get_Frame(_uint iIndex); @@ -38,7 +42,6 @@ class ENGINE_DLL CChannel : public CBase // HRESULT Initialize(const vector& Bones, _uint iIndex); - private: _char m_szName[MAX_PATH] = {}; // 영향을 받을 본의 이름 _int m_iBoneIndex = { -1 }; // 본 벡터에서 본의 인덱스 @@ -46,7 +49,11 @@ class ENGINE_DLL CChannel : public CBase _float4x4 m_PreTransformMatrix = {}; vector m_KeyFrames; // 키프레임 벡터 _float3 m_vPrevRootPos = { 0.f, 0.f, 0.f }; + _float4 m_vPrevRootRot = { 0.f, 0.f, 0.f,0.f }; _matrix m_BoneTransformationMatrix = {}; + _float m_fPrevYaw = 0.f; + _bool m_bInitialRootRotSaved = {false}; +_float4 m_vInitialRootRot = {}; public: static CChannel* Create(const vector& Bones, _uint iIndex); // 럴프전용 static CChannel* Create(HANDLE hFile, DWORD& dwByte); diff --git a/Jusin154_Team3D/Engine/Public/FSM.h b/Jusin154_Team3D/Engine/Public/FSM.h index af92dd6e7..736f2c6ca 100644 --- a/Jusin154_Team3D/Engine/Public/FSM.h +++ b/Jusin154_Team3D/Engine/Public/FSM.h @@ -3,17 +3,16 @@ NS_BEGIN(FSMSTATE) enum ESTATE { - IDLE, + IDLE,IDLE_TURN, MOVE, WALK, WALK_FWD, WALK_BWD, JOG, SPRINT, JUMP, LAND, DODGE, - COMBAT, LIGHT_ATTACK, CAST, SKILL, + COMBAT, LIGHT_ATTACK, CAST, SKILL,SKILL2, END }; NS_END - NS_BEGIN(Engine) class CState; diff --git a/Jusin154_Team3D/Engine/Public/State.h b/Jusin154_Team3D/Engine/Public/State.h index df29cf0e7..13abe1d97 100644 --- a/Jusin154_Team3D/Engine/Public/State.h +++ b/Jusin154_Team3D/Engine/Public/State.h @@ -1,6 +1,22 @@ #pragma once #include "Base.h" +NS_BEGIN(STATEANIM) +enum ESTATE +{ + IDLE, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD, + MOVE, + WALK, WALK_FWD, WALK_BWD, WALK_STOP, + JOG, + SPRINT, + JUMP,JUMP_WALK,JUMP_SPRINT, + LAND, + DODGE, + COMBAT, LIGHT_ATTACK, CAST, SKILL, SKILL2, + END +}; +NS_END + NS_BEGIN(Engine) class CUnit; class CModel; diff --git a/Jusin154_Team3D/Engine/Public/Transform.h b/Jusin154_Team3D/Engine/Public/Transform.h index 2f352efbe..690439bbe 100644 --- a/Jusin154_Team3D/Engine/Public/Transform.h +++ b/Jusin154_Team3D/Engine/Public/Transform.h @@ -57,6 +57,7 @@ class ENGINE_DLL CTransform final : void BookMomentum(_fvector vMomentum); void Turn(_fvector vAxis, _float fTimeDelta); + void TurnAngle(_vector vAxis, _float fAngle); void Rotation(_fvector vAxis, _float fRadian); void Rotation(_float fRadianX, _float fRadianY, _float fRadianZ); void Rotation(_float3& vRadian); diff --git a/Jusin154_Team3D/Engine/Public/Unit.h b/Jusin154_Team3D/Engine/Public/Unit.h index 7bd6ca6e8..45bc73380 100644 --- a/Jusin154_Team3D/Engine/Public/Unit.h +++ b/Jusin154_Team3D/Engine/Public/Unit.h @@ -39,6 +39,7 @@ class ENGINE_DLL CUnit abstract : public CGameObject void Set_LightCombo(_uint LightCombo) { m_iLightCombo = LightCombo; } _float Get_KeyFrame(_string FrameName); _bool IsCurrentKeyFrame(_string FrameName); + virtual void Reset_Sprint() {}; #pragma endregion protected: