diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 8d2b7722f..3fff42202 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -236,21 +236,13 @@ - - - - - - - - - - - - - - - + + + + + + + @@ -368,21 +360,13 @@ - - - - - - - - - - - - - - - + + + + + + + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index 253f9506f..725a8e632 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -223,12 +223,6 @@ {9c21aba5-00c1-4b4c-8a82-dac7a156fd9b} - - {d5681f71-af29-4418-bf3a-a1486c6ba171} - - - {904a7ae5-33fe-49a1-9f31-27443acc9e1a} - {680910fd-aee2-4f69-b644-12b36b0f635b} @@ -274,36 +268,9 @@ {04d044a9-3cab-4425-9adf-8eea436e71d4} - - {0b8cac41-419f-48ce-87bc-805b8962b4df} - {26e2dcaa-d94a-4c3d-ba39-2916f2a27bac} - - {dac78c4e-b898-45dc-8740-794899de0c69} - - - {1cac1aa6-ea12-429e-8a84-ca2bf44c2be4} - - - {43bc0f97-0b7d-406b-900c-0fae023023ec} - - - {a56502cb-b0b8-4ea7-bc5e-5482b416fef9} - - - {5f6e884b-3ab2-4354-b378-44e8221a4720} - - - {0aa8e406-d786-4e40-b825-54d5e3f691e2} - - - {eb7d24ee-d60e-4062-b974-264409436d81} - - - {b017e167-f48d-4417-a924-765ab802cff5} - {f5cd19e8-186b-418f-b7fa-af73046a80d1} @@ -313,15 +280,6 @@ {8882358e-c8eb-4222-a87e-01d902533b8f} - - {3614836d-9988-4ec0-95a8-f8ebc25a9a13} - - - {98f012a4-2f13-456f-85ba-6929b1535de6} - - - {3ad2f4c4-95e6-47fa-9f4c-b9fcdbd77277} - {a9862861-6eaa-4e04-b7f6-217a32db7db4} @@ -355,6 +313,33 @@ {92110a48-81d0-4e98-be06-05dd078d0488} + + {a56502cb-b0b8-4ea7-bc5e-5482b416fef9} + + + {8a70232d-f917-4ff6-b617-302e325996ae} + + + {dac78c4e-b898-45dc-8740-794899de0c69} + + + {d5681f71-af29-4418-bf3a-a1486c6ba171} + + + {029a22c4-ab06-4db0-9527-4e3cfa1a2e0d} + + + {b017e167-f48d-4417-a924-765ab802cff5} + + + {904a7ae5-33fe-49a1-9f31-27443acc9e1a} + + + {0b8cac41-419f-48ce-87bc-805b8962b4df} + + + {c1e05cd0-4551-487b-8e47-4119db646c60} + @@ -564,20 +549,14 @@ 02.GameObjects\Dummys\DummyPhysX\PhysXWall - - 80.State\State_Combat\State_Dodge + + 80.State\Focus\State_Dodge - - 80.State\State_Idle + + 80.State\Movement\State_Idle - - 80.State\State_Move\State_Walk - - - 80.State\State_Move\State_Sprint - - - 80.State\State_Jump + + 80.State\Focus\State_Jump 02.GameObjects\Player @@ -627,25 +606,16 @@ 02.GameObjects\Dummys\DummyGlobe - - 80.State\State_Combat\State_Skill - - - 80.State\State_Combat\State_LightAttack - - - 80.State\State_Land + + 80.State\Focus\State_Land 02.GameObjects\Monster\Goblin - - 80.State\State_Combat\State_Cast + + 80.State\Movement\State_Move - - 80.State\State_Move - - + 80.State\State_Combat @@ -657,15 +627,6 @@ 02.GameObjects\Layer_Effect\Effect\05.NomalJap - - 80.State\State_Combat\State_Skill2 - - - 80.State\State_Idle\State_Idle_Turn - - - 80.State\State_Move\State_Jog - 02.GameObjects\Broom @@ -696,12 +657,12 @@ 02.GameObjects\Camera - - 80.State - 02.GameObjects\Wand + + 80.State + @@ -916,23 +877,14 @@ 02.GameObjects\Dummys\DummyPhysX\PhysXDoorSet\PhysXDoorFrame - - 80.State\State_Combat\State_Dodge + + 80.State\Focus\State_Dodge - - 80.State\State_Idle + + 80.State\Movement\State_Idle - - 80.State\State_Move\State_Walk - - - 80.State\State_Move\State_Sprint - - - 80.State\State_Jump - - - 02.GameObjects\Player + + 80.State\Focus\State_Jump 02.GameObjects\Env\04.Land @@ -970,25 +922,16 @@ 02.GameObjects\Dummys\DummyGlobe - - 80.State\State_Combat\State_Skill - - - 80.State\State_Combat\State_LightAttack - - - 80.State\State_Land + + 80.State\Focus\State_Land 02.GameObjects\Monster\Goblin - - 80.State\State_Combat\State_Cast + + 80.State\Movement\State_Move - - 80.State\State_Move - - + 80.State\State_Combat @@ -1000,15 +943,6 @@ 02.GameObjects\Layer_Effect\Effect\05.NomalJap - - 80.State\State_Combat\State_Skill2 - - - 80.State\State_Idle\State_Idle_Turn - - - 80.State\State_Move\State_Jog - 02.GameObjects\Broom @@ -1039,12 +973,15 @@ 02.GameObjects\Camera - - 80.State - 02.GameObjects\Wand + + 80.State + + + 02.GameObjects\Player + diff --git a/Jusin154_Team3D/Editor/Private/DummyObject.cpp b/Jusin154_Team3D/Editor/Private/DummyObject.cpp index 45d67b060..006d8b704 100644 --- a/Jusin154_Team3D/Editor/Private/DummyObject.cpp +++ b/Jusin154_Team3D/Editor/Private/DummyObject.cpp @@ -3,12 +3,6 @@ #include "GameInstance.h" #include "DebugCamera.h" -#include "State_Idle.h" -#include "State_Walk.h" -#include "State_Dodge.h" -#include "State_Sprint.h" -#include "State_Jump.h" -#include "State_Skill.h" CDummyObject::CDummyObject(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CUnit(pDevice, pContext) diff --git a/Jusin154_Team3D/Editor/Private/Player.cpp b/Jusin154_Team3D/Editor/Private/Player.cpp index fe0ae3ece..46a4c3e19 100644 --- a/Jusin154_Team3D/Editor/Private/Player.cpp +++ b/Jusin154_Team3D/Editor/Private/Player.cpp @@ -8,22 +8,13 @@ #include "Wand.h" #pragma region STATE -#include "State_Root.h" -#include "State_Idle.h" -#include "State_Walk.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" +#include "State_Player_Idle.h" +#include "State_Player_Dodge.h" +#include "State_Player_Jump.h" +#include "State_Player_Land.h" +#include "State_Player_Move.h" +#include "State_Player_Combat.h" #pragma endregion CPlayer::CPlayer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -57,8 +48,6 @@ HRESULT CPlayer::Initialize(void* pArg) Add_FSM(); - Set_FSM(); - Set_Anim(); Setup_InputConditions(); @@ -79,7 +68,7 @@ void CPlayer::Update(_float fTimeDelta) Key_Input(fTimeDelta); - m_pFSM->Update(fTimeDelta); + m_pFSM->Update_State(fTimeDelta); m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); @@ -257,10 +246,7 @@ void CPlayer::Setup_InputConditions() void CPlayer::Key_Input(_float fTimeDelta) { - if (m_pFSM->Get_CurrState() == FSMSTATE::WALK || - m_pFSM->Get_CurrState() == FSMSTATE::SPRINT|| - m_pFSM->Get_CurrState() == FSMSTATE::DODGE|| - m_pFSM->Get_CurrState() == FSMSTATE::JOG) + if (m_pFSM->IsEnable(FSMSTATE::WALK|FSMSTATE::SPRINT |FSMSTATE::DODGE |FSMSTATE::JOG)) { if (m_pGameInstance->Key_Pressing(DIK_LEFT)) m_pTransformCom->Turn(-m_pTransformCom->Get_State(STATE::UP), fTimeDelta); @@ -276,56 +262,42 @@ void CPlayer::Key_Input(_float fTimeDelta) void CPlayer::Add_FSM() { -#pragma region MOVE - m_pFSM->Add_State(FSMSTATE::MOVE, new CState_Move()); - 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::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 region Behavior_Movement_NotFocus + { + CState_Player_Idle::STATE_PLAYER_IDLE_DESC Desc{}; + Desc.pOwner = this; + m_States.emplace(FSMSTATE::MOVE, CState_Player_Idle::Create(&Desc)); + } + { + CState_Player_Move::STATE_PLAYER_MOVE_DESC Desc{}; + Desc.pOwner = this; + m_States.emplace(FSMSTATE::MOVE, CState_Player_Move::Create(&Desc)); + } #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()); +#pragma region Behavior_Movement_Focus + { + CState_Player_Jump::STATE_PLAYER_JUMP_DESC Desc{}; + Desc.pOwner = this; + m_States.emplace(FSMSTATE::LAND, CState_Player_Jump::Create(&Desc)); + } + { + CState_Player_Land::STATE_PLAYER_LAND_DESC Desc{}; + Desc.pOwner = this; + m_States.emplace(FSMSTATE::LAND, CState_Player_Land::Create(&Desc)); + } + { + CState_Player_Dodge::STATE_PLAYER_DODGE_DESC Desc{}; + Desc.pOwner = this; + m_States.emplace(FSMSTATE::LAND, CState_Player_Dodge::Create(&Desc)); + } #pragma endregion +#pragma region Behavior_Combat_NotFocus - m_pFSM->Add_State(FSMSTATE::JUMP, new CState_Jump()); - m_pFSM->Add_State(FSMSTATE::LAND, new CState_Land()); - - m_pFSM->Add_State(FSMSTATE::ROOT, new CState_Root()); - -} - -void CPlayer::Set_FSM() -{ -#pragma region ROOT - m_pFSM->Set_Parent(FSMSTATE::MOVE, FSMSTATE::ROOT); - m_pFSM->Set_Parent(FSMSTATE::COMBAT, FSMSTATE::ROOT); +#pragma endregion +#pragma region Behavior_Combat_Focus #pragma endregion -#pragma region MOVE - m_pFSM->Set_Parent(FSMSTATE::IDLE, FSMSTATE::MOVE); - m_pFSM->Set_Parent(FSMSTATE::IDLE_TURN, FSMSTATE::MOVE); - m_pFSM->Set_Parent(FSMSTATE::WALK, FSMSTATE::MOVE); - m_pFSM->Set_Parent(FSMSTATE::BWD, FSMSTATE::MOVE); - m_pFSM->Set_Parent(FSMSTATE::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); -#pragma endregion } void CPlayer::Set_Anim() diff --git a/Jusin154_Team3D/Editor/Private/State_Cast.cpp b/Jusin154_Team3D/Editor/Private/State_Cast.cpp deleted file mode 100644 index 42c192faa..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Cast.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "pch.h" -#include "State_Cast.h" -#include "Unit.h" - - -CState_Cast::CState_Cast() - :CState() -{ -} - -void CState_Cast::Enter() -{ - if (m_pFSM->Get_PrevState() == FSMSTATE::CAST) - return; - - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::CAST); - m_pModel->Set_AnimationIndex(anim.first, anim.second); -} - -void CState_Cast::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; -} - -void CState_Cast::Exit() -{ -} - -_bool CState_Cast::CheckExitState() -{ - if (m_pOwner->Check(FSMSTATE::CAST)) - { - _uint combo = m_pOwner->Next_LightCombo(); - m_pOwner->Set_LightCombo(combo); - if (combo >= 3) - { - m_pOwner->Reset_LightCombo(); - return true; - } - - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::CAST); - m_pModel->Set_AnimationIndex(anim.first + combo, anim.second); - - m_pFSM->Change_State(FSMSTATE::CAST); - - return true; - } - - if (m_pOwner->Check(FSMSTATE::SKILL2)) - { - m_pOwner->Reset_LightCombo(); - m_pFSM->Change_State(FSMSTATE::SKILL2); - return true; - } - - return false; -} - -void CState_Cast::Free() -{ - __super::Free(); -} - -void CState_Cast::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_Combat.cpp b/Jusin154_Team3D/Editor/Private/State_Combat.cpp deleted file mode 100644 index bdff385da..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Combat.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "pch.h" -#include "State_Combat.h" -#include "Unit.h" - - -CState_Combat::CState_Combat() - :CState() -{ -} - -void CState_Combat::Enter() -{ - 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::SKILL)) - m_pFSM->Change_State(FSMSTATE::SKILL); - - if (m_pOwner->Check(FSMSTATE::SKILL)) - m_pFSM->Change_State(FSMSTATE::SKILL); - - if (m_pOwner->Check(FSMSTATE::SKILL2)) - m_pFSM->Change_State(FSMSTATE::SKILL2); - -} - -void CState_Combat::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; -} - -void CState_Combat::Exit() -{ -} - -_bool CState_Combat::CheckExitState() -{ - if (m_pOwner->IsCurrentKeyFrame("Jump")) - { - m_pOwner->Reset_LightCombo(); - m_pFSM->Change_State(FSMSTATE::MOVE); - return true; - } - - return false; -} - - -void CState_Combat::Free() -{ - __super::Free(); -} - -void CState_Combat::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_Dodge.cpp b/Jusin154_Team3D/Editor/Private/State_Dodge.cpp deleted file mode 100644 index 3c4ce4151..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Dodge.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "pch.h" -#include "State_Dodge.h" -#include "Unit.h" - - -CState_Dodge::CState_Dodge() - :CState() -{ -} - -void CState_Dodge::Enter() -{ - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::DODGE); - m_pModel->Set_AnimationIndex(anim.first, anim.second); -} - -void CState_Dodge::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; -} - -void CState_Dodge::Exit() -{ -} - -_bool CState_Dodge::CheckExitState() -{ - if (m_pModel->IsFinishedAnim()) - m_pFSM->Change_State(FSMSTATE::IDLE); - - if (m_pOwner->Check(FSMSTATE::SPRINT) && m_pOwner->IsCurrentKeyFrame("Dodge")) - m_pFSM->Change_State(FSMSTATE::SPRINT); - - if (m_pOwner->Check(FSMSTATE::WALK) && m_pOwner->IsCurrentKeyFrame("Dodge")) - m_pFSM->Change_State(FSMSTATE::WALK); - - if (m_pOwner->Check(FSMSTATE::JOG) && m_pOwner->IsCurrentKeyFrame("Dodge")) - m_pFSM->Change_State(FSMSTATE::JOG); - - - - return false; -} - -void CState_Dodge::Free() -{ - __super::Free(); -} - -void CState_Dodge::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_Idle.cpp b/Jusin154_Team3D/Editor/Private/State_Idle.cpp deleted file mode 100644 index 5f4140c0c..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Idle.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "pch.h" -#include "State_Idle.h" -#include "Unit.h" - -CState_Idle::CState_Idle() - :CState() -{ -} - -void CState_Idle::Enter() -{ - if (m_pFSM->Get_PrevState() == FSMSTATE::JOG) - { - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::JOG_STOP); - m_pModel->Set_AnimationIndex(anim.first, anim.second); - return; - } - 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) -{ - if (CheckExitState()) - return; -} - -void CState_Idle::Exit() -{ -} - -_bool CState_Idle::CheckExitState() -{ - if (m_pOwner->Check(FSMSTATE::JOG)) - m_pFSM->Change_State(FSMSTATE::JOG); - - 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::IDLE_TURN)) - m_pFSM->Change_State(FSMSTATE::IDLE_TURN); - - if (m_pOwner->Check(FSMSTATE::JUMP)) - m_pFSM->Change_State(FSMSTATE::JUMP); - - return false; -} - -void CState_Idle::Free() -{ - __super::Free(); -} - -void CState_Idle::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_Idle_Turn.cpp b/Jusin154_Team3D/Editor/Private/State_Idle_Turn.cpp deleted file mode 100644 index d0b9f1712..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Idle_Turn.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#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 deleted file mode 100644 index b895ed11e..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Jog.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "pch.h" -#include "State_Jog.h" -#include "Unit.h" - -CState_Jog::CState_Jog() - :CState() -{ -} - -void CState_Jog::Enter() -{ - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::JOG_FWD); - m_pModel->Set_AnimationIndex(anim.first, anim.second); - - m_pOwner->Reset_Sprint(); - m_pOwner->Reset_Walk(); -} - -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); - - if (m_pOwner->Check(FSMSTATE::WALK)) - m_pFSM->Change_State(FSMSTATE::WALK); - - 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); - - if (m_pOwner->Check(FSMSTATE::JUMP)) - m_pFSM->Change_State(FSMSTATE::JUMP); - - - 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 deleted file mode 100644 index 051f93fb0..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Jump.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "pch.h" -#include "State_Jump.h" -#include "Unit.h" - - -CState_Jump::CState_Jump() - :CState() -{ -} - -void CState_Jump::Enter() -{ - 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::JOG)) - { - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::JUMP_JOG); - 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); -} - -void CState_Jump::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; -} - -void CState_Jump::Exit() -{ -} - -_bool CState_Jump::CheckExitState() -{ - if (m_pOwner->IsCurrentKeyFrame("Jump")) - m_pFSM->Change_State(FSMSTATE::LAND); - - return false; -} - -void CState_Jump::Free() -{ - __super::Free(); -} - -void CState_Jump::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_Land.cpp b/Jusin154_Team3D/Editor/Private/State_Land.cpp deleted file mode 100644 index 7fda0cd37..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Land.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "pch.h" -#include "State_Land.h" -#include "Unit.h" - - -CState_Land::CState_Land() - :CState() -{ -} - -void CState_Land::Enter() -{ - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::LAND); - m_pModel->Set_AnimationIndex(anim.first, anim.second); -} - -void CState_Land::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; -} - -void CState_Land::Exit() -{ -} - -_bool CState_Land::CheckExitState() -{ - if (m_pModel->IsFinishedAnim()) - m_pFSM->Change_State(FSMSTATE::IDLE); - - - if (m_pOwner->Check(FSMSTATE::JOG)) - m_pFSM->Change_State(FSMSTATE::JOG); - - if (m_pOwner->Check(FSMSTATE::SPRINT)) - m_pFSM->Change_State(FSMSTATE::SPRINT); - - return false; -} - -void CState_Land::Free() -{ - __super::Free(); -} - -void CState_Land::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp b/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp deleted file mode 100644 index aa2375570..000000000 --- a/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "pch.h" -#include "State_LightAttack.h" -#include "Unit.h" - - -CState_LightAttack::CState_LightAttack() - :CState() -{ -} - -void CState_LightAttack::Enter() -{ - if (m_pFSM->Get_PrevState() == FSMSTATE::LIGHT_ATTACK) - return; - - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::LIGHT_ATTACK); - m_pModel->Set_AnimationIndex(anim.first, anim.second); -} - -void CState_LightAttack::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; -} - -void CState_LightAttack::Exit() -{ -} - -_bool CState_LightAttack::CheckExitState() -{ - if (m_pOwner->Check(FSMSTATE::LIGHT_ATTACK)) - { - _uint combo = m_pOwner->Next_LightCombo(); - m_pOwner->Set_LightCombo(combo); - if (combo >= 4) - { - m_pOwner->Reset_LightCombo(); - return true; - } - - 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); - - return true; - } - - - if (m_pOwner->Check(FSMSTATE::SKILL2)) - { - m_pOwner->Reset_LightCombo(); - m_pFSM->Change_State(FSMSTATE::SKILL2); - return true; - } - - return false; -} - - -void CState_LightAttack::Free() -{ - __super::Free(); -} - -void CState_LightAttack::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_Move.cpp b/Jusin154_Team3D/Editor/Private/State_Move.cpp deleted file mode 100644 index cce8c760f..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Move.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "pch.h" -#include "State_Move.h" -#include "Unit.h" - - -CState_Move::CState_Move() - :CState() -{ -} - -void CState_Move::Enter() -{ - - if (m_pOwner->Check(FSMSTATE::WALK)) - m_pFSM->Change_State(FSMSTATE::WALK); - - if (m_pOwner->Check(FSMSTATE::JOG)) - m_pFSM->Change_State(FSMSTATE::JOG); - - 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::IDLE_TURN)) - m_pFSM->Change_State(FSMSTATE::IDLE_TURN); - - m_pFSM->Change_State(FSMSTATE::IDLE); -} - -void CState_Move::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; -} - -void CState_Move::Exit() -{ -} - -_bool CState_Move::CheckExitState() -{ - return false; -} - - -void CState_Move::Free() -{ - __super::Free(); -} - -void CState_Move::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_Player.cpp b/Jusin154_Team3D/Editor/Private/State_Player.cpp new file mode 100644 index 000000000..c5510913e --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/State_Player.cpp @@ -0,0 +1,51 @@ +#include "pch.h" +#include "State_Player.h" +#include "Unit.h" + +CState_Player::CState_Player() + :CState() +{ +} + +void CState_Player::Enter() +{ + if (nullptr != m_funcEnterEvent) { + m_funcEnterEvent(); + } +} + +HRESULT CState_Player::Update(_float fTimeDelta) +{ + HRESULT hr = { S_OK }; + if (nullptr != m_funcExitCheck) { + hr = m_funcExitCheck(fTimeDelta); + } + return hr; +} + +void CState_Player::Exit() +{ + if (nullptr != m_funcExitEvent) { + m_funcExitEvent(); + } +} + +HRESULT CState_Player::Initialize(STATE_PLAYER_DESC* pArg) +{ + if (FAILED(__super::Initialize(pArg))) { + return E_FAIL; + } + m_funcExitCheck = pArg->funcExitCheck; + m_funcEnterEvent = pArg->funcEnterEvent; + m_funcExitEvent = pArg->funcExitEvent; + return S_OK; +} + +void CState_Player::Free() +{ + __super::Free(); +} + +void CState_Player::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/State_Player_Combat.cpp b/Jusin154_Team3D/Editor/Private/State_Player_Combat.cpp new file mode 100644 index 000000000..535c8ae60 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/State_Player_Combat.cpp @@ -0,0 +1,57 @@ +#include "pch.h" +#include "State_Player_Combat.h" +#include "Unit.h" + + +CState_Player_Combat::CState_Player_Combat() + :CState_Player() +{ +} + +void CState_Player_Combat::Enter() +{ + __super::Enter(); +} + +HRESULT CState_Player_Combat::Update(_float fTimeDelta) +{ + if (E_FAIL == (__super::Update(fTimeDelta))) { + return E_FAIL; + } + return S_OK; +} + +void CState_Player_Combat::Exit() +{ + __super::Exit(); +} + +HRESULT CState_Player_Combat::Initialize(STATE_PLAYER_COMBAT_DESC* pDesc) +{ + if (FAILED(__super::Initialize(pDesc))) { + return E_FAIL; + } + m_pOwner = pDesc->pOwner; + m_pModel = m_pOwner->Get_Component(); + m_pFSM = m_pOwner->Get_Component(); + + return S_OK; +} + +CState_Player_Combat* CState_Player_Combat::Create(STATE_PLAYER_COMBAT_DESC* pDesc) +{ + CState_Player_Combat* pInstance = new CState_Player_Combat; + if (FAILED(pInstance->Initialize(pDesc))) { + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CState_Player_Combat::Free() +{ + __super::Free(); +} + +void CState_Player_Combat::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/State_Player_Dodge.cpp b/Jusin154_Team3D/Editor/Private/State_Player_Dodge.cpp new file mode 100644 index 000000000..348c8c816 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/State_Player_Dodge.cpp @@ -0,0 +1,56 @@ +#include "pch.h" +#include "State_Player_Dodge.h" +#include "Unit.h" + + +CState_Player_Dodge::CState_Player_Dodge() + :CState_Player() +{ +} + +void CState_Player_Dodge::Enter() +{ + __super::Enter(); +} + +HRESULT CState_Player_Dodge::Update(_float fTimeDelta) +{ + if (E_FAIL == (__super::Update(fTimeDelta))) { + return E_FAIL; + } + return S_OK; +} + +void CState_Player_Dodge::Exit() +{ + __super::Exit(); +} + +HRESULT CState_Player_Dodge::Initialize(STATE_PLAYER_DODGE_DESC* pDesc) +{ + if (FAILED(__super::Initialize(pDesc))) { + return E_FAIL; + } + m_pModel = m_pOwner->Get_Component(); + m_pFSM = m_pOwner->Get_Component(); + + return S_OK; +} + +CState_Player_Dodge* CState_Player_Dodge::Create(STATE_PLAYER_DODGE_DESC* pDesc) +{ + CState_Player_Dodge* pInstance = new CState_Player_Dodge; + if (FAILED(pInstance->Initialize(pDesc))) { + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CState_Player_Dodge::Free() +{ + __super::Free(); +} + +void CState_Player_Dodge::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/State_Player_Idle.cpp b/Jusin154_Team3D/Editor/Private/State_Player_Idle.cpp new file mode 100644 index 000000000..1b1259e60 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/State_Player_Idle.cpp @@ -0,0 +1,55 @@ +#include "pch.h" +#include "State_Player_Idle.h" +#include "Unit.h" + +CState_Player_Idle::CState_Player_Idle() + :CState_Player() +{ +} + +void CState_Player_Idle::Enter() +{ + __super::Enter(); +} + +HRESULT CState_Player_Idle::Update(_float fTimeDelta) +{ + if (E_FAIL == (__super::Update(fTimeDelta))) { + return E_FAIL; + } + return S_OK; +} + +void CState_Player_Idle::Exit() +{ + __super::Exit(); +} + +HRESULT CState_Player_Idle::Initialize(STATE_PLAYER_IDLE_DESC* pDesc) +{ + if (FAILED(__super::Initialize(pDesc))) { + return E_FAIL; + } + m_pModel = m_pOwner->Get_Component(); + m_pFSM = m_pOwner->Get_Component(); + + return S_OK; +} + +CState_Player_Idle* CState_Player_Idle::Create(STATE_PLAYER_IDLE_DESC* pDesc) +{ + CState_Player_Idle* pInstance = new CState_Player_Idle; + if (FAILED(pInstance->Initialize(pDesc))) { + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CState_Player_Idle::Free() +{ + __super::Free(); +} + +void CState_Player_Idle::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/State_Player_Jump.cpp b/Jusin154_Team3D/Editor/Private/State_Player_Jump.cpp new file mode 100644 index 000000000..c7a16ed0f --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/State_Player_Jump.cpp @@ -0,0 +1,56 @@ +#include "pch.h" +#include "State_Player_Jump.h" +#include "Unit.h" + + +CState_Player_Jump::CState_Player_Jump() + :CState_Player() +{ +} + +void CState_Player_Jump::Enter() +{ + __super::Enter(); +} + +HRESULT CState_Player_Jump::Update(_float fTimeDelta) +{ + if (E_FAIL == (__super::Update(fTimeDelta))) { + return E_FAIL; + } + return S_OK; +} + +void CState_Player_Jump::Exit() +{ + __super::Exit(); +} + +HRESULT CState_Player_Jump::Initialize(STATE_PLAYER_JUMP_DESC* pDesc) +{ + if (FAILED(__super::Initialize(pDesc))) { + return E_FAIL; + } + m_pModel = m_pOwner->Get_Component(); + m_pFSM = m_pOwner->Get_Component(); + + return S_OK; +} + +CState_Player_Jump* CState_Player_Jump::Create(STATE_PLAYER_JUMP_DESC* pDesc) +{ + CState_Player_Jump* pInstance = new CState_Player_Jump; + if (FAILED(pInstance->Initialize(pDesc))) { + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CState_Player_Jump::Free() +{ + __super::Free(); +} + +void CState_Player_Jump::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/State_Player_Land.cpp b/Jusin154_Team3D/Editor/Private/State_Player_Land.cpp new file mode 100644 index 000000000..af536e870 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/State_Player_Land.cpp @@ -0,0 +1,56 @@ +#include "pch.h" +#include "State_Player_Land.h" +#include "Unit.h" + + +CState_Player_Land::CState_Player_Land() + :CState_Player() +{ +} + +void CState_Player_Land::Enter() +{ + __super::Enter(); +} + +HRESULT CState_Player_Land::Update(_float fTimeDelta) +{ + if (E_FAIL == (__super::Update(fTimeDelta))) { + return E_FAIL; + } + return S_OK; +} + +void CState_Player_Land::Exit() +{ + __super::Exit(); +} + +HRESULT CState_Player_Land::Initialize(STATE_PLAYER_LAND_DESC* pDesc) +{ + if (FAILED(__super::Initialize(pDesc))) { + return E_FAIL; + } + m_pModel = m_pOwner->Get_Component(); + m_pFSM = m_pOwner->Get_Component(); + + return S_OK; +} + +CState_Player_Land* CState_Player_Land::Create(STATE_PLAYER_LAND_DESC* pDesc) +{ + CState_Player_Land* pInstance = new CState_Player_Land; + if (FAILED(pInstance->Initialize(pDesc))) { + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CState_Player_Land::Free() +{ + __super::Free(); +} + +void CState_Player_Land::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/State_Player_Move.cpp b/Jusin154_Team3D/Editor/Private/State_Player_Move.cpp new file mode 100644 index 000000000..4a2a06a90 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/State_Player_Move.cpp @@ -0,0 +1,56 @@ +#include "pch.h" +#include "State_Player_Move.h" +#include "Unit.h" + + +CState_Player_Move::CState_Player_Move() + :CState_Player() +{ +} + +void CState_Player_Move::Enter() +{ + __super::Enter(); +} + +HRESULT CState_Player_Move::Update(_float fTimeDelta) +{ + if (E_FAIL == (__super::Update(fTimeDelta))) { + return E_FAIL; + } + return S_OK; +} + +void CState_Player_Move::Exit() +{ + __super::Exit(); +} + +HRESULT CState_Player_Move::Initialize(STATE_PLAYER_MOVE_DESC* pDesc) +{ + if (FAILED(__super::Initialize(pDesc))) { + return E_FAIL; + } + m_pModel = m_pOwner->Get_Component(); + m_pFSM = m_pOwner->Get_Component(); + + return S_OK; +} + +CState_Player_Move* CState_Player_Move::Create(STATE_PLAYER_MOVE_DESC* pDesc) +{ + CState_Player_Move* pInstance = new CState_Player_Move; + if (FAILED(pInstance->Initialize(pDesc))) { + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CState_Player_Move::Free() +{ + __super::Free(); +} + +void CState_Player_Move::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/State_Root.cpp b/Jusin154_Team3D/Editor/Private/State_Root.cpp deleted file mode 100644 index efef8727b..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Root.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "pch.h" -#include "State_Root.h" -#include "Unit.h" - - -CState_Root::CState_Root() - :CState() -{ -} - -void CState_Root::Enter() -{ - if (m_pOwner->Check(FSMSTATE::COMBAT)) - m_pFSM->Change_State(FSMSTATE::COMBAT); - - else - m_pFSM->Change_State(FSMSTATE::MOVE); -} - -void CState_Root::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; -} - -void CState_Root::Exit() -{ -} - -_bool CState_Root::CheckExitState() -{ - if (m_pOwner->Check(FSMSTATE::COMBAT)) - { - if (m_pFSM->Get_Current()->Get_Parent()->Get_State() != FSMSTATE::COMBAT) - m_pFSM->Change_State(FSMSTATE::COMBAT); - - return true; - } - - if (m_pFSM->Get_Current()->Get_Parent()->Get_State() == FSMSTATE::COMBAT) - return false; - - if (m_pOwner->Check(FSMSTATE::MOVE)) - { - if (m_pFSM->Get_Current()->Get_Parent()->Get_State() != FSMSTATE::MOVE) - m_pFSM->Change_State(FSMSTATE::MOVE); - - return true; - } - - return false; -} - - -void CState_Root::Free() -{ - __super::Free(); -} - -void CState_Root::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_Skill.cpp b/Jusin154_Team3D/Editor/Private/State_Skill.cpp deleted file mode 100644 index 277606272..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Skill.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "pch.h" -#include "State_Skill.h" -#include "Unit.h" - - -CState_Skill::CState_Skill() - :CState() -{ -} - -void CState_Skill::Enter() -{ - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::SKILL); - m_pModel->Set_AnimationIndex(anim.first, anim.second); -} - -void CState_Skill::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; -} - -void CState_Skill::Exit() -{ -} - -_bool CState_Skill::CheckExitState() -{ - - return false; -} - -void CState_Skill::Free() -{ - __super::Free(); -} - -void CState_Skill::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_Skill2.cpp b/Jusin154_Team3D/Editor/Private/State_Skill2.cpp deleted file mode 100644 index 03704ac90..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Skill2.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#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 deleted file mode 100644 index 71efa2951..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Sprint.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "pch.h" -#include "State_Sprint.h" -#include "Unit.h" - -CState_Sprint::CState_Sprint() - :CState() -{ -} - -void CState_Sprint::Enter() -{ - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::SPRINT); - m_pModel->Set_AnimationIndex(anim.first, anim.second); -} - -void CState_Sprint::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; - -} - -void CState_Sprint::Exit() -{ -} - -_bool CState_Sprint::CheckExitState() -{ - if (!m_pOwner->Check(FSMSTATE::SPRINT)) - m_pFSM->Change_State(FSMSTATE::JOG); - - 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; -} - -void CState_Sprint::Free() -{ - __super::Free(); -} - -void CState_Sprint::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Private/State_Walk.cpp b/Jusin154_Team3D/Editor/Private/State_Walk.cpp deleted file mode 100644 index c49a5ee2b..000000000 --- a/Jusin154_Team3D/Editor/Private/State_Walk.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "pch.h" -#include "State_Walk.h" -#include "Unit.h" - -CState_Walk::CState_Walk() - :CState() -{ -} - -void CState_Walk::Enter() -{ - if(m_pOwner->Check(FSMSTATE::FWD)) - { - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_FWD); - m_pModel->Set_AnimationIndex(anim.first, anim.second); - } - - if (m_pOwner->Check(FSMSTATE::BWD)) - { - auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_BWD); - m_pModel->Set_AnimationIndex(anim.first, anim.second); - } -} - -void CState_Walk::Update(_float fTimeDelta) -{ - if (CheckExitState()) - return; -} - -void CState_Walk::Exit() -{ -} - -_bool CState_Walk::CheckExitState() -{ - 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); - - - return false; -} - -void CState_Walk::Free() -{ - __super::Free(); -} - -void CState_Walk::Describe_Entity() -{ -} diff --git a/Jusin154_Team3D/Editor/Public/Player.h b/Jusin154_Team3D/Editor/Public/Player.h index 6e42215ed..bf9e0f3fd 100644 --- a/Jusin154_Team3D/Editor/Public/Player.h +++ b/Jusin154_Team3D/Editor/Public/Player.h @@ -29,9 +29,13 @@ class CPlayer final : public CUnit _bool Set_Sprint(_bool bSprint) { m_bSprintToggle = bSprint; } private: + unordered_map m_States = { }; + size_t m_iStateMask = { 0 }; + vector m_InputConditions; _bool m_bSprintToggle = { false }; _bool m_bWalkToggle = { false }; + class CCamPosition_Player* m_pCamPosition_TopDown_LookPart = { nullptr }; class CCamPosition_Arm* m_pCamPosition_TopDown_FollowPart = { nullptr }; private: @@ -50,7 +54,6 @@ class CPlayer final : public CUnit #pragma region STATE private: virtual void Add_FSM(); - virtual void Set_FSM(); virtual void Set_Anim(); _bool Check(FSMSTATE::ESTATE state); _bool IsSprint(); diff --git a/Jusin154_Team3D/Editor/Public/State_Cast.h b/Jusin154_Team3D/Editor/Public/State_Cast.h deleted file mode 100644 index 6a64c3881..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Cast.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - -class CState_Cast final : public CState -{ -public: - CState_Cast(); - virtual ~CState_Cast() = 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_Combat.h b/Jusin154_Team3D/Editor/Public/State_Combat.h deleted file mode 100644 index 7fe636c65..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Combat.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - -class CState_Combat final : public CState -{ -public: - CState_Combat(); - virtual ~CState_Combat() = 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_Dodge.h b/Jusin154_Team3D/Editor/Public/State_Dodge.h deleted file mode 100644 index 788056b67..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Dodge.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - -class CState_Dodge final : public CState -{ -public: - CState_Dodge(); - virtual ~CState_Dodge() = 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_Idle.h b/Jusin154_Team3D/Editor/Public/State_Idle.h deleted file mode 100644 index 898162432..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Idle.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - -class CState_Idle final : public CState -{ -public: - CState_Idle(); - virtual ~CState_Idle() = 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_Idle_Turn.h b/Jusin154_Team3D/Editor/Public/State_Idle_Turn.h deleted file mode 100644 index c39f90ee8..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Idle_Turn.h +++ /dev/null @@ -1,21 +0,0 @@ -#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 deleted file mode 100644 index 5fa7c5008..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Jog.h +++ /dev/null @@ -1,21 +0,0 @@ -#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_Jump.h b/Jusin154_Team3D/Editor/Public/State_Jump.h deleted file mode 100644 index 1433dc4aa..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Jump.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - -class CState_Jump final : public CState -{ -public: - CState_Jump(); - virtual ~CState_Jump() = 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_Land.h b/Jusin154_Team3D/Editor/Public/State_Land.h deleted file mode 100644 index 6cc48272b..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Land.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - -class CState_Land final : public CState -{ -public: - CState_Land(); - virtual ~CState_Land() = 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_LightAttack.h b/Jusin154_Team3D/Editor/Public/State_LightAttack.h deleted file mode 100644 index b048d0feb..000000000 --- a/Jusin154_Team3D/Editor/Public/State_LightAttack.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - -class CState_LightAttack final : public CState -{ -public: - CState_LightAttack(); - virtual ~CState_LightAttack() = 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_Move.h b/Jusin154_Team3D/Editor/Public/State_Move.h deleted file mode 100644 index 18ef685af..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Move.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - -class CState_Move final : public CState -{ -public: - CState_Move(); - virtual ~CState_Move() = 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_Player.h b/Jusin154_Team3D/Editor/Public/State_Player.h new file mode 100644 index 000000000..ca51e8ab9 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/State_Player.h @@ -0,0 +1,38 @@ +#pragma once +#include "Editor_Define.h" +#include "State.h" + +NS_BEGIN(Editor) + +class CState_Player abstract : public CState +{ +protected: + typedef struct tagStatePlayer : public CState::STATEDESC { + function funcExitCheck = { nullptr }; + function funcEnterEvent = { nullptr }; + function funcExitEvent = { nullptr }; + }STATE_PLAYER_DESC; + +protected: + CState_Player(); + virtual ~CState_Player() = default; + +protected: + virtual void Enter() override; + virtual HRESULT Update(_float fTimeDelta) override; + virtual void Exit() override; + +protected: + function m_funcExitCheck = { nullptr }; + function m_funcEnterEvent = { nullptr }; + function m_funcExitEvent = { nullptr }; + +protected: + HRESULT Initialize(STATE_PLAYER_DESC* pArg); + +public: + virtual void Free() override; + virtual void Describe_Entity(); +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/State_Player_Combat.h b/Jusin154_Team3D/Editor/Public/State_Player_Combat.h new file mode 100644 index 000000000..8ea945f99 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/State_Player_Combat.h @@ -0,0 +1,31 @@ +#pragma once +#include "Editor_Define.h" +#include "State_Player.h" + +NS_BEGIN(Editor) + +class CState_Player_Combat final : public CState_Player +{ +public: + typedef struct tagCombat : public CState_Player::STATE_PLAYER_DESC { + + }STATE_PLAYER_COMBAT_DESC; +private: + CState_Player_Combat(); + virtual ~CState_Player_Combat() = default; + +public: + virtual void Enter(); + virtual HRESULT Update(_float fTimeDelta); + virtual void Exit(); + +private: + HRESULT Initialize(STATE_PLAYER_COMBAT_DESC* pDesc); + +public: + static CState_Player_Combat* Create(STATE_PLAYER_COMBAT_DESC* pDesc); + virtual void Free() override; + virtual void Describe_Entity(); +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/State_Player_Dodge.h b/Jusin154_Team3D/Editor/Public/State_Player_Dodge.h new file mode 100644 index 000000000..f5f57ecf4 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/State_Player_Dodge.h @@ -0,0 +1,27 @@ +#pragma once +#include "Editor_Define.h" +#include "State_Player.h" + +class CState_Player_Dodge final : public CState_Player +{ +public: + typedef struct tagDodge : public CState_Player::STATE_PLAYER_DESC { + + }STATE_PLAYER_DODGE_DESC; +public: + CState_Player_Dodge(); + virtual ~CState_Player_Dodge() = default; + +public: + virtual void Enter(); + virtual HRESULT Update(_float fTimeDelta); + virtual void Exit(); + +private: + HRESULT Initialize(STATE_PLAYER_DODGE_DESC* pDesc); + +public: + static CState_Player_Dodge* Create(STATE_PLAYER_DODGE_DESC* pDesc); + virtual void Free() override; + virtual void Describe_Entity(); +}; diff --git a/Jusin154_Team3D/Editor/Public/State_Player_Idle.h b/Jusin154_Team3D/Editor/Public/State_Player_Idle.h new file mode 100644 index 000000000..4ef6c194e --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/State_Player_Idle.h @@ -0,0 +1,28 @@ +#pragma once +#include "Editor_Define.h" +#include "State_Player.h" + +class CState_Player_Idle final : public CState_Player +{ +public: + typedef struct tagIdle : public CState_Player::STATE_PLAYER_DESC { + + }STATE_PLAYER_IDLE_DESC; +public: + CState_Player_Idle(); + virtual ~CState_Player_Idle() = default; + +public: + virtual void Enter(); + virtual HRESULT Update(_float fTimeDelta); + virtual void Exit(); + +private: + HRESULT Initialize(STATE_PLAYER_IDLE_DESC* pDesc); + +public: + static CState_Player_Idle* Create(STATE_PLAYER_IDLE_DESC* pDesc); + virtual void Free() override; + virtual void Describe_Entity(); +}; + diff --git a/Jusin154_Team3D/Editor/Public/State_Player_Jump.h b/Jusin154_Team3D/Editor/Public/State_Player_Jump.h new file mode 100644 index 000000000..e6e50b6ec --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/State_Player_Jump.h @@ -0,0 +1,31 @@ +#pragma once +#include "Editor_Define.h" +#include "State_Player.h" + +NS_BEGIN(Editor) + +class CState_Player_Jump final : public CState_Player +{ +public: + typedef struct tagJump : public CState_Player::STATE_PLAYER_DESC { + + }STATE_PLAYER_JUMP_DESC; +private: + CState_Player_Jump(); + virtual ~CState_Player_Jump() = default; + +public: + virtual void Enter(); + virtual HRESULT Update(_float fTimeDelta); + virtual void Exit(); + +private: + HRESULT Initialize(STATE_PLAYER_JUMP_DESC* pDesc); + +public: + static CState_Player_Jump* Create(STATE_PLAYER_JUMP_DESC* pDesc); + virtual void Free() override; + virtual void Describe_Entity(); +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/State_Player_Land.h b/Jusin154_Team3D/Editor/Public/State_Player_Land.h new file mode 100644 index 000000000..8c77b645d --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/State_Player_Land.h @@ -0,0 +1,31 @@ +#pragma once +#include "Editor_Define.h" +#include "State_Player.h" + +NS_BEGIN(Editor) + +class CState_Player_Land final : public CState_Player +{ +public: + typedef struct tagLand : public CState_Player::STATE_PLAYER_DESC { + + }STATE_PLAYER_LAND_DESC; +private: + CState_Player_Land(); + virtual ~CState_Player_Land() = default; + +public: + virtual void Enter(); + virtual HRESULT Update(_float fTimeDelta); + virtual void Exit(); + +private: + HRESULT Initialize(STATE_PLAYER_LAND_DESC* pDesc); + +public: + static CState_Player_Land* Create(STATE_PLAYER_LAND_DESC* pDesc); + virtual void Free() override; + virtual void Describe_Entity(); +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/State_Player_Move.h b/Jusin154_Team3D/Editor/Public/State_Player_Move.h new file mode 100644 index 000000000..e11b26c39 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/State_Player_Move.h @@ -0,0 +1,31 @@ +#pragma once +#include "Editor_Define.h" +#include "State_Player.h" + +NS_BEGIN(Editor) + +class CState_Player_Move final : public CState_Player +{ +public: + typedef struct tagMove : public CState_Player::STATE_PLAYER_DESC { + + }STATE_PLAYER_MOVE_DESC; +private: + CState_Player_Move(); + virtual ~CState_Player_Move() = default; + +public: + virtual void Enter(); + virtual HRESULT Update(_float fTimeDelta); + virtual void Exit(); + +private: + HRESULT Initialize(STATE_PLAYER_MOVE_DESC* pDesc); + +public: + static CState_Player_Move* Create(STATE_PLAYER_MOVE_DESC* pDesc); + virtual void Free() override; + virtual void Describe_Entity(); +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/State_Root.h b/Jusin154_Team3D/Editor/Public/State_Root.h deleted file mode 100644 index 9b02d4449..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Root.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - -class CState_Root final : public CState -{ -public: - CState_Root(); - virtual ~CState_Root() = 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_Skill.h b/Jusin154_Team3D/Editor/Public/State_Skill.h deleted file mode 100644 index 5866e87bb..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Skill.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - -class CState_Skill final : public CState -{ -public: - CState_Skill(); - virtual ~CState_Skill() = 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 deleted file mode 100644 index 652630d4b..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Skill2.h +++ /dev/null @@ -1,19 +0,0 @@ -#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/Editor/Public/State_Sprint.h b/Jusin154_Team3D/Editor/Public/State_Sprint.h deleted file mode 100644 index ae31033f4..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Sprint.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - - -class CState_Sprint final : public CState -{ -public: - CState_Sprint(); - virtual ~CState_Sprint() = 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_Walk.h b/Jusin154_Team3D/Editor/Public/State_Walk.h deleted file mode 100644 index 71ac52832..000000000 --- a/Jusin154_Team3D/Editor/Public/State_Walk.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "Editor_Define.h" -#include "State.h" - - -class CState_Walk final : public CState -{ -public: - CState_Walk(); - virtual ~CState_Walk() = 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/FSM.cpp b/Jusin154_Team3D/Engine/Private/FSM.cpp index 193a4a8d8..5312974af 100644 --- a/Jusin154_Team3D/Engine/Private/FSM.cpp +++ b/Jusin154_Team3D/Engine/Private/FSM.cpp @@ -5,12 +5,10 @@ CFSM::CFSM(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CComponent(pDevice, pContext) { - m_States.resize(FSMSTATE::END); } CFSM::CFSM(const CFSM& rhs) - : CComponent(rhs), - m_States(rhs.m_States) + : CComponent(rhs) { } @@ -24,62 +22,30 @@ HRESULT CFSM::Initialize(void* pArg) return S_OK; } -void CFSM::Add_State(_uint iIndex, CState* state) +void CFSM::Change_State(size_t iStateMask) { - m_States[iIndex] = state; - m_States[iIndex]->Set_State(iIndex); - m_States[iIndex]->Set_Owner(m_pOwner); - m_States[iIndex]->Set_Component(); + if (nullptr != m_pCurrentState) { // 현재 스테이트가 비워져 있으면 우회 + if (IsEnable(iStateMask)) { // 이미 활성화 된 스테이트면 리턴 + return; + } + m_iPreviousStateMask = *m_pStateMask; + + m_pCurrentState->Exit(); + SAFE_RELEASE(m_pPreviousState); // Prev State 를 지움 + m_pPreviousState = m_pCurrentState; + } + + m_pCurrentState = m_pStates->at(iStateMask); + SAFE_ADDREF(m_pCurrentState); + m_pCurrentState->Enter(); } -void CFSM::Change_State(_uint iIndex) +void CFSM::Update_State(_float fTimeDelta) { - m_pPrevious = m_pCurrent; - - if (m_pCurrent) - m_pCurrent->Exit(); - - m_pCurrent = m_States[iIndex]; - - if (m_pCurrent) - m_pCurrent->Enter(); -} - -void CFSM::Update(_float fTimeDelta) -{ - vector States; - - CState* pCurrent = m_pCurrent; - - while (pCurrent) + if (nullptr != m_pCurrentState) { - States.push_back(pCurrent); - pCurrent = pCurrent->Get_Parent(); + m_pCurrentState->Update(fTimeDelta); } - - for (_int i = (_int)States.size() - 1; i >= 0; --i) { - States[i]->Update(fTimeDelta); - } -} - -_uint CFSM::Get_CurrState() -{ - return m_pCurrent->Get_State(); -} - -_uint CFSM::Get_PrevState() -{ - if (m_pPrevious) - return m_pPrevious->Get_State(); - return 0; -} - -void CFSM::Set_Parent(FSMSTATE::ESTATE Child, FSMSTATE::ESTATE Parent) -{ - CState* pChild = m_States[Child]; - CState* pParent = m_States[Parent]; - if (pChild && pParent) - pChild->Set_Parent(pParent); } CFSM* CFSM::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -95,7 +61,7 @@ CFSM* CFSM::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) return pInstance; } -CComponent* CFSM::Clone(void* pArg, class CGameObject* pOwner) +CFSM* CFSM::Clone(void* pArg, class CGameObject* pOwner) { CFSM* pInstance = new CFSM(*this); pInstance->m_pOwner = pOwner; @@ -112,14 +78,16 @@ void CFSM::Free() { __super::Free(); - SAFE_RELEASE(m_pCurrent); - SAFE_RELEASE(m_pPrevious); + SAFE_RELEASE(m_pCurrentState); + SAFE_RELEASE(m_pPreviousState); - for (auto& states : m_States) - { - SAFE_RELEASE(states); + if (nullptr != m_pStates) { + unordered_map::iterator iter = m_pStates->begin(); + for (; iter != m_pStates->end(); ++iter) { + SAFE_RELEASE(iter->second); + } + m_pStates = nullptr; } - m_States.clear(); } void CFSM::Describe_Entity() diff --git a/Jusin154_Team3D/Engine/Private/State.cpp b/Jusin154_Team3D/Engine/Private/State.cpp index 6c1963261..cf51b1604 100644 --- a/Jusin154_Team3D/Engine/Private/State.cpp +++ b/Jusin154_Team3D/Engine/Private/State.cpp @@ -9,32 +9,10 @@ CState::CState() SAFE_ADDREF(m_pGameInstance); } -void CState::Enter() +HRESULT CState::Initialize(STATEDESC* pArg) { -} - -void CState::Update(_float fTimeDelta) -{ -} - -void CState::Exit() -{ -} - -_bool CState::CheckExitState() -{ - return true; -} - -void CState::Set_Owner(CGameObject* pOwner) -{ - m_pOwner = dynamic_cast(pOwner); -}; - -void CState::Set_Component() -{ - m_pModel = m_pOwner->Get_Component(); - m_pFSM = m_pOwner->Get_Component(); + m_pOwner = pArg->pOwner; + return S_OK; } void CState::Free() @@ -42,7 +20,6 @@ void CState::Free() __super::Free(); SAFE_RELEASE(m_pGameInstance); - SAFE_RELEASE(m_pParent); } void CState::Describe_Entity() diff --git a/Jusin154_Team3D/Engine/Public/FSM.h b/Jusin154_Team3D/Engine/Public/FSM.h index 4ce544413..219bd03c7 100644 --- a/Jusin154_Team3D/Engine/Public/FSM.h +++ b/Jusin154_Team3D/Engine/Public/FSM.h @@ -20,33 +20,47 @@ class CState; class ENGINE_DLL CFSM final : public CComponent { +public: + typedef struct tagFSMDesc + { + unordered_map* pStates = { nullptr }; + size_t* pStateMask = { nullptr }; + }FSM_DESC; private: CFSM(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CFSM(const CFSM& rhs); virtual ~CFSM() = default; public: - void Add_State(_uint iIndex, CState* state); - void Change_State(_uint iIndex); - void Update(_float fTimeDelta); + void Change_State(size_t iStateMask); + void Update_State(_float fTimeDelta); + + CState* Get_PrevState() { return m_pPreviousState; } + size_t Get_PrevStateMask() { return m_iPreviousStateMask; } + + //inline void Enable_State(size_t stateMask) { *m_pStateMask |= stateMask; } + //inline void Set_State(size_t initialStateMask) { *m_pStateMask = initialStateMask; } + //inline void Disable_State(size_t stateMask) { *m_pStateMask &= ~stateMask; } + + inline _bool IsEnable(size_t stateMask) const { return (*m_pStateMask & stateMask) != 0; } + inline _bool IsEnable_Previous(size_t stateMask) const { return (m_iPreviousStateMask & stateMask) != 0; } - CState* Get_Current() { return m_pCurrent; } - _uint Get_CurrState(); - _uint Get_PrevState(); - void Set_Parent(FSMSTATE::ESTATE Child, FSMSTATE::ESTATE Parent); private: - vector m_States; - CState* m_pCurrent = { nullptr }; - CState* m_pPrevious = { nullptr }; + unordered_map* m_pStates = { nullptr }; + size_t* m_pStateMask = { nullptr }; + + size_t m_iPreviousStateMask = { 0 }; + + CState* m_pCurrentState = { nullptr }; + CState* m_pPreviousState = { nullptr }; private: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; - public: static CFSM* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); - virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override; + virtual CFSM* Clone(void* pArg, class CGameObject* pOwner = nullptr) override; virtual void Free() override; virtual void Describe_Entity() override; }; diff --git a/Jusin154_Team3D/Engine/Public/State.h b/Jusin154_Team3D/Engine/Public/State.h index 477012e87..27f5f9c52 100644 --- a/Jusin154_Team3D/Engine/Public/State.h +++ b/Jusin154_Team3D/Engine/Public/State.h @@ -22,33 +22,31 @@ class CUnit; class CModel; class CFSM; class CGameInstance; + class ENGINE_DLL CState abstract : public CBase { +protected: + typedef struct tagStateDesc { + class CUnit* pOwner = { nullptr }; + }STATEDESC; + protected: CState(); virtual ~CState() = default; public: - virtual void Enter(); - virtual void Update(_float fTimeDelta); - virtual void Exit(); - virtual _bool CheckExitState(); - void Set_Owner(class CGameObject* pOwner); - virtual void Set_Component(); + virtual void Enter()PURE; + virtual HRESULT Update(_float fTimeDelta)PURE; + virtual void Exit()PURE; - void Set_State(_uint State) { m_eState = State; } - _uint Get_State() { return m_eState; } - void Set_Parent(CState* State) { m_pParent = State; } - CState* Get_Parent() { return m_pParent; } protected: CUnit* m_pOwner = { nullptr }; CModel* m_pModel = { nullptr }; CFSM* m_pFSM = { nullptr }; - CState* m_pParent = { nullptr }; CGameInstance* m_pGameInstance = { nullptr }; - _uint m_eState = {}; - +protected: + HRESULT Initialize(STATEDESC* pArg); public: virtual void Free() override;