@@ -0,0 +1,231 @@
|
||||
#include "pch.h"
|
||||
#include "Broom.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
|
||||
#pragma region STATE
|
||||
#include "State_Idle.h"
|
||||
#include "State_Dodge.h"
|
||||
#include "State_Jump.h"
|
||||
#include "State_Land.h"
|
||||
#include "State_Move.h"
|
||||
#include "State_Combat.h"
|
||||
#include "State_Broom_Ride.h"
|
||||
#pragma endregion
|
||||
|
||||
#pragma region States
|
||||
|
||||
HRESULT CBroom::InputAction()
|
||||
{
|
||||
if (
|
||||
m_pGameInstance->Key_Down(DIK_SPACE)
|
||||
|| m_pGameInstance->Key_Down(DIK_LCONTROL)
|
||||
|| m_pGameInstance->Key_Down(DIK_E)
|
||||
|| m_pGameInstance->Key_Down(DIK_R)
|
||||
|| m_pGameInstance->Key_Down(DIK_Q)
|
||||
|| m_pGameInstance->Mouse_Up(DIM_LBUTTON)
|
||||
|| m_pGameInstance->Key_Down(DIK_LSHIFT)
|
||||
|| m_pGameInstance->Key_Down(DIK_C)
|
||||
|| m_pGameInstance->Key_Down(DIK_V)
|
||||
|| m_pGameInstance->Key_Down(DIK_Z)
|
||||
|| m_pGameInstance->Key_Down(DIK_G)
|
||||
|| m_pGameInstance->Key_Down(DIK_B)
|
||||
)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT CBroom::InputMove()
|
||||
{
|
||||
if (m_pGameInstance->Key_Pressing(DIK_W)
|
||||
|| m_pGameInstance->Key_Pressing(DIK_A)
|
||||
|| m_pGameInstance->Key_Pressing(DIK_S)
|
||||
|| m_pGameInstance->Key_Pressing(DIK_D))
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT CBroom::InputKeyUpMove()
|
||||
{
|
||||
if (m_pGameInstance->Key_Up(DIK_W)
|
||||
|| m_pGameInstance->Key_Up(DIK_A)
|
||||
|| m_pGameInstance->Key_Up(DIK_S)
|
||||
|| m_pGameInstance->Key_Up(DIK_D))
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT CBroom::InputSpell()
|
||||
{
|
||||
if (
|
||||
m_pGameInstance->Key_Down(DIK_1)
|
||||
|| m_pGameInstance->Key_Down(DIK_2)
|
||||
|| m_pGameInstance->Key_Down(DIK_3)
|
||||
|| m_pGameInstance->Key_Down(DIK_4)
|
||||
)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CBroom::InputAim()
|
||||
{
|
||||
if (m_pGameInstance->Mouse_Pressing(DIM_RBUTTON) ||
|
||||
m_pGameInstance->Mouse_Pressing(DIM_LBUTTON))
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
void CBroom::Behavior_IdleEnter() {
|
||||
m_pFSM->Enable_State(FSMSTATE::IDLE);
|
||||
pair<_uint, _bool> pairAnimInfo;
|
||||
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_HOVER_IDLE_B];
|
||||
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
|
||||
HRESULT CBroom::Behavior_IdleExitCheck(_float fTimeDelta)
|
||||
{
|
||||
pair<_uint, _bool> pairAnimInfo;
|
||||
if (SUCCEEDED(InputAction())) {
|
||||
if (m_pGameInstance->Key_Down(DIK_B)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_MOUNT_B];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
}
|
||||
|
||||
if (SUCCEEDED(InputMove()))
|
||||
{
|
||||
m_pFSM->Change_State(FSMSTATE::MOVE);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
void CBroom::Behavior_IdleExit()
|
||||
{
|
||||
m_pFSM->Disable_State(FSMSTATE::IDLE);
|
||||
}
|
||||
|
||||
void CBroom::Behavior_MoveEnter()
|
||||
{
|
||||
pair<_uint, _bool> pairAnimInfo = {};
|
||||
_bool bFoward = m_pGameInstance->Key_Pressing(DIK_W);
|
||||
_bool bLeft = m_pGameInstance->Key_Pressing(DIK_A);
|
||||
_bool bRight = m_pGameInstance->Key_Pressing(DIK_D);
|
||||
_bool bBackward = m_pGameInstance->Key_Pressing(DIK_S);
|
||||
m_pFSM->Enable_State(FSMSTATE::MOVE);
|
||||
if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE)) {
|
||||
m_pFSM->Enable_State(FSMSTATE::JOG);
|
||||
if (SUCCEEDED(InputMove()))
|
||||
{
|
||||
if (bFoward)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FLY_B];
|
||||
}
|
||||
else if (bLeft)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FLY_LEFT_B];
|
||||
}
|
||||
else if (bRight)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FLY_RIGHT_B];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
|
||||
HRESULT CBroom::Behavior_MoveExitCheck(_float fTimeDelta)
|
||||
{
|
||||
pair<_uint, _bool> pairAnimInfo = {};
|
||||
_bool bFoward = m_pGameInstance->Key_Pressing(DIK_W);
|
||||
_bool bLeft = m_pGameInstance->Key_Pressing(DIK_A);
|
||||
_bool bRight = m_pGameInstance->Key_Pressing(DIK_D);
|
||||
_bool bBackward = m_pGameInstance->Key_Pressing(DIK_S);
|
||||
|
||||
if (SUCCEEDED(InputMove()))
|
||||
{
|
||||
if (bFoward)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FLY_B];
|
||||
m_pTransformCom->Go_Straight(fTimeDelta);
|
||||
}
|
||||
else if (bLeft)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FLY_LEFT_B];
|
||||
}
|
||||
else if (bRight)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FLY_RIGHT_B];
|
||||
}
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
void CBroom::Behavior_MoveExit()
|
||||
{
|
||||
m_pFSM->Disable_State(FSMSTATE::MOVE | FSMSTATE::SPRINT | FSMSTATE::JOG | FSMSTATE::WALK);
|
||||
}
|
||||
|
||||
void CBroom::Add_FSM()
|
||||
{
|
||||
#pragma region Behavior_Movement_NotFocus
|
||||
{
|
||||
CState_Idle::STATE_IDLE_DESC Desc{};
|
||||
Desc.pOwner = this;
|
||||
Desc.funcEnterEvent = [this]() { Behavior_IdleEnter(); };
|
||||
Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_IdleExitCheck(fTimedelta); };
|
||||
Desc.funcExitEvent = [this]() { Behavior_IdleExit(); };
|
||||
Desc.funcPriorityUpdate = nullptr;
|
||||
Desc.funcLateUpdate = nullptr;
|
||||
m_States.emplace(FSMSTATE::IDLE, CState_Idle::Create(&Desc));
|
||||
}
|
||||
{
|
||||
CState_Move::STATE_MOVE_DESC Desc{};
|
||||
Desc.pOwner = this;
|
||||
Desc.funcEnterEvent = [this]() { Behavior_MoveEnter(); };
|
||||
Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_MoveExitCheck(fTimedelta); };
|
||||
Desc.funcExitEvent = [this]() { Behavior_MoveExit(); };
|
||||
Desc.funcPriorityUpdate = nullptr;
|
||||
Desc.funcLateUpdate = nullptr;
|
||||
m_States.emplace(FSMSTATE::MOVE, CState_Move::Create(&Desc));
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
void CBroom::Set_Anim()
|
||||
{
|
||||
m_Animation[STATEANIM::BROOM_MOUNT_B] = { 29,false };
|
||||
m_Animation[STATEANIM::BROOM_HOVER_IDLE_B] = { 24,true };
|
||||
m_Animation[STATEANIM::BROOM_HOVER_STOP_B] = { 6,false };
|
||||
m_Animation[STATEANIM::BROOM_FLY_B] = { 5,true };
|
||||
m_Animation[STATEANIM::BROOM_FLY_DOWN_B] = { 13,true };
|
||||
m_Animation[STATEANIM::BROOM_FLY_LEFT_B] = { 15,true };
|
||||
m_Animation[STATEANIM::BROOM_FLY_RIGHT_B] = { 16,true };
|
||||
m_Animation[STATEANIM::BROOM_FLY_UP_B] = { 17,true };
|
||||
//Mount 29
|
||||
//호버 스탑 6
|
||||
//호버 제자리 24
|
||||
//플라이 업 17 다운 13 왼쪽15 오른쪽 16
|
||||
}
|
||||
#pragma endregion State
|
||||
|
||||
|
||||
@@ -228,6 +228,7 @@ call Update_Resources.bat
|
||||
<ClInclude Include="..\Public\Spell_Overlay.h" />
|
||||
<ClInclude Include="..\Public\Spell_Slot.h" />
|
||||
<ClInclude Include="..\Public\Spell_UI.h" />
|
||||
<ClInclude Include="..\Public\State_Broom_Ride.h" />
|
||||
<ClInclude Include="..\Public\State_Combat.h" />
|
||||
<ClInclude Include="..\Public\State_Dodge.h" />
|
||||
<ClInclude Include="..\Public\State_Idle.h" />
|
||||
@@ -316,6 +317,7 @@ call Update_Resources.bat
|
||||
<ClCompile Include="..\Private\Spell_Overlay.cpp" />
|
||||
<ClCompile Include="..\Private\Spell_Slot.cpp" />
|
||||
<ClCompile Include="..\Private\Spell_UI.cpp" />
|
||||
<ClCompile Include="..\Private\State_Broom_Ride.cpp" />
|
||||
<ClCompile Include="..\Private\State_Combat.cpp" />
|
||||
<ClCompile Include="..\Private\State_Dodge.cpp" />
|
||||
<ClCompile Include="..\Private\State_Idle.cpp" />
|
||||
@@ -327,6 +329,7 @@ call Update_Resources.bat
|
||||
<ClCompile Include="..\private\Terrain.cpp" />
|
||||
<ClCompile Include="..\Private\TrailObject.cpp" />
|
||||
<ClCompile Include="..\Private\Wand.cpp" />
|
||||
<ClCompile Include="Broom_States.cpp" />
|
||||
<ClCompile Include="Client.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -253,6 +253,9 @@
|
||||
<ClInclude Include="..\public\StreetContainer.h">
|
||||
<Filter>02.GameObjects\Environment\00.MapContainer\StreetContainer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\State_Broom_Ride.h">
|
||||
<Filter>04.Mechanic\State\Broom</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Client.ico">
|
||||
@@ -551,6 +554,9 @@
|
||||
<Filter Include="02.GameObjects\UI\GamePlay_Canvas\Action_Panel\Spell_UI">
|
||||
<UniqueIdentifier>{9914341c-f246-4fdb-b28c-de7a6d2d149b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="04.Mechanic\State\Broom">
|
||||
<UniqueIdentifier>{48b905c1-b91e-44ca-a61b-86633826768b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Environment\00.MapContainer\StreetContainer">
|
||||
<UniqueIdentifier>{e12a4228-0754-4217-b65d-7f962409f85c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -793,6 +799,12 @@
|
||||
<ClCompile Include="..\Private\Potion.cpp">
|
||||
<Filter>02.GameObjects\UI\GamePlay_Canvas\Action_Panel\Potion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Broom_States.cpp">
|
||||
<Filter>02.GameObjects\Item\Broom</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\State_Broom_Ride.cpp">
|
||||
<Filter>04.Mechanic\State\Broom</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\StreetContainer.cpp">
|
||||
<Filter>02.GameObjects\Environment\00.MapContainer\StreetContainer</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include "GameInstance.h"
|
||||
|
||||
CBroom::CBroom(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CGameObject(pDevice, pContext)
|
||||
: CUnit(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CBroom::CBroom(const CBroom& Prototype)
|
||||
: CGameObject(Prototype)
|
||||
: CUnit(Prototype)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -27,7 +27,19 @@ HRESULT CBroom::Initialize(void* pArg)
|
||||
if (FAILED(Ready_Components()))
|
||||
return E_FAIL;
|
||||
|
||||
m_pModelCom->Set_AnimationIndex(5);
|
||||
Add_FSM();
|
||||
|
||||
Set_Anim();
|
||||
|
||||
{
|
||||
CFSM::FSM_DESC FSMDesc{};
|
||||
FSMDesc.pStates = &m_States;
|
||||
FSMDesc.pStateMask = &m_iStateMask;
|
||||
|
||||
m_pFSM->Bind_States(FSMDesc);
|
||||
m_pFSM->Change_State(FSMSTATE::IDLE);
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -38,12 +50,14 @@ void CBroom::Priority_Update(_float fTimeDelta)
|
||||
|
||||
void CBroom::Update(_float fTimeDelta)
|
||||
{
|
||||
m_pFSM->Update_State(fTimeDelta);
|
||||
|
||||
m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom);
|
||||
}
|
||||
|
||||
void CBroom::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
|
||||
HRESULT CBroom::Render()
|
||||
@@ -96,8 +110,10 @@ HRESULT CBroom::Ready_Components()
|
||||
|
||||
/* Com_Shader */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_ANIMMESH,
|
||||
reinterpret_cast<CComponent**>(&m_pShaderCom))))
|
||||
reinterpret_cast<CComponent**>(&m_pShaderCom)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -151,11 +167,6 @@ CGameObject* CBroom::Clone(void* pArg, CGameObject* pOwner)
|
||||
void CBroom::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
|
||||
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
|
||||
@@ -182,13 +182,15 @@ HRESULT CLevel_GamePlay::Ready_Markers()
|
||||
|
||||
HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CPlayer>(g_iStaticLevel, NEXT_LEVEL, strLayerTag))){
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CBroom>(g_iStaticLevel, NEXT_LEVEL, strLayerTag,nullptr,nullptr,&m_pBroom)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CPlayer>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, m_pBroom))){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
/*if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CBroom>(g_iStaticLevel, NEXT_LEVEL, strLayerTag)))
|
||||
return E_FAIL;*/
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -579,7 +579,7 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Broom_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Broom/Broom.bin", XMMatrixIdentity()))))
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Object/Broom/Broom.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Goblin_Model"),
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "State_Land.h"
|
||||
#include "State_Move.h"
|
||||
#include "State_Combat.h"
|
||||
#include "State_Broom_Ride.h"
|
||||
#pragma endregion
|
||||
|
||||
#include "Layer.h"
|
||||
@@ -58,6 +59,8 @@ HRESULT CPlayer::Initialize(void* pArg)
|
||||
Load_KeyFrame();
|
||||
#endif // _DEBUG
|
||||
|
||||
m_pBroomModel = static_cast<CGameObject*>(pArg)->Get_Component<CModel>();
|
||||
m_pBroomTransform = static_cast<CGameObject*>(pArg)->Get_Component<CTransform>();
|
||||
|
||||
Add_FSM();
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "State_Land.h"
|
||||
#include "State_Move.h"
|
||||
#include "State_Combat.h"
|
||||
#include "State_Broom_Ride.h"
|
||||
#pragma endregion
|
||||
|
||||
#include "EffectPool.h"
|
||||
@@ -67,6 +68,7 @@ HRESULT CPlayer::InputAction()
|
||||
|| m_pGameInstance->Key_Down(DIK_V)
|
||||
|| m_pGameInstance->Key_Down(DIK_Z)
|
||||
|| m_pGameInstance->Key_Down(DIK_G)
|
||||
|| m_pGameInstance->Key_Down(DIK_B)
|
||||
)
|
||||
{
|
||||
return S_OK;
|
||||
@@ -132,6 +134,8 @@ void CPlayer::Behavior_IdleEnter() {
|
||||
if (m_pGameInstance->Mouse_Pressing(DIM_LBUTTON)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::IDLE_AIM];
|
||||
}
|
||||
else
|
||||
pairAnimInfo = m_Animation[STATEANIM::IDLE];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -176,6 +180,9 @@ HRESULT CPlayer::Behavior_IdleExitCheck(_float fTimeDelta)
|
||||
else if (m_pGameInstance->Key_Down(DIK_G)) {
|
||||
m_pFSM->Change_State(FSMSTATE::COMBAT);
|
||||
}
|
||||
else if (m_pGameInstance->Key_Down(DIK_B)) {
|
||||
m_pFSM->Change_State(FSMSTATE::BROOM_RIDE);
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -362,6 +369,9 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
|
||||
else if (m_pGameInstance->Key_Down(DIK_G)) {
|
||||
m_pFSM->Change_State(FSMSTATE::COMBAT);
|
||||
}
|
||||
else if (m_pGameInstance->Key_Down(DIK_B)) {
|
||||
m_pFSM->Change_State(FSMSTATE::BROOM_RIDE);
|
||||
}
|
||||
else if (m_pGameInstance->Key_Down(DIK_LSHIFT)) {
|
||||
m_bSprintToggle = !m_bSprintToggle;
|
||||
m_bWalkToggle = false;
|
||||
@@ -442,7 +452,7 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
|
||||
}
|
||||
if (!bSkipAngleCheck) {
|
||||
_float absDir = fabsf(vDir);
|
||||
if (absDir <= XMConvertToRadians(70.f)) {
|
||||
if (absDir <= XMConvertToRadians(90.f)) {
|
||||
if (m_pFSM->IsEnable(FSMSTATE::JOG))
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_FWD];
|
||||
@@ -518,7 +528,6 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
|
||||
|
||||
if (m_pFSM->IsEnable(FSMSTATE::JOG | FSMSTATE::WALK | FSMSTATE::SPRINT)||
|
||||
!SUCCEEDED(InputMove())) {
|
||||
|
||||
if (!m_pFSM->IsEnable(FSMSTATE::STOP))
|
||||
{
|
||||
m_pFSM->Enable_State(FSMSTATE::STOP);
|
||||
@@ -531,7 +540,22 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
else if (m_pFSM->IsEnable(FSMSTATE::JOG)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_STOP];
|
||||
if (iCurrentAnimIndex == m_Animation[STATEANIM::JOG_AIM_LEFT].first)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_AIM_STOP_L];
|
||||
}
|
||||
else if (iCurrentAnimIndex == m_Animation[STATEANIM::JOG_AIM_RIGHT].first)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_AIM_STOP_R];
|
||||
}
|
||||
else if (iCurrentAnimIndex == m_Animation[STATEANIM::JOG_AIM_BWD].first)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_AIM_STOP_BWD];
|
||||
}
|
||||
else {
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_STOP];
|
||||
}
|
||||
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
}
|
||||
@@ -558,16 +582,16 @@ void CPlayer::Behavior_JumpEnter()
|
||||
m_pFSM->Enable_State(FSMSTATE::JUMP);
|
||||
if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE | FSMSTATE::WALK | FSMSTATE::JOG | FSMSTATE::SPRINT)) {
|
||||
if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE)) {
|
||||
pairAnimInfo = Get_AnimInfo(STATEANIM::JUMP);
|
||||
pairAnimInfo = m_Animation[STATEANIM::JUMP];
|
||||
}
|
||||
else if (m_pFSM->IsEnable_Previous(FSMSTATE::SPRINT)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::JUMP_SPRINT];
|
||||
}
|
||||
else if (m_pFSM->IsEnable_Previous(FSMSTATE::WALK)) {
|
||||
pairAnimInfo = Get_AnimInfo(STATEANIM::JUMP);
|
||||
pairAnimInfo = m_Animation[STATEANIM::JUMP];
|
||||
}
|
||||
else if (m_pFSM->IsEnable_Previous(FSMSTATE::JOG)) {
|
||||
pairAnimInfo = Get_AnimInfo(STATEANIM::JUMP_JOG);
|
||||
pairAnimInfo = m_Animation[STATEANIM::JUMP_JOG];
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -593,7 +617,7 @@ void CPlayer::Behavior_JumpExit()
|
||||
void CPlayer::Behavior_LandEnter()
|
||||
{
|
||||
m_pFSM->Enable_State(FSMSTATE::LAND);
|
||||
pair<_uint, _bool> pairAnimInfo = Get_AnimInfo(STATEANIM::LAND);
|
||||
pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::LAND];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
|
||||
@@ -620,7 +644,7 @@ void CPlayer::Behavior_DodgeEnter()
|
||||
{
|
||||
// 혹시 @@ to Dodge 있으면 여기에
|
||||
m_pFSM->Enable_State(FSMSTATE::DODGE);
|
||||
pair<_uint, _bool> pairAnimInfo = Get_AnimInfo(STATEANIM::DODGE);
|
||||
pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::DODGE];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
|
||||
@@ -783,8 +807,6 @@ HRESULT CPlayer::Behavior_CombatExitCheck()
|
||||
case STATEANIM::ACCIO:
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::ACCIO];
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case STATEANIM::DESCENDO:
|
||||
@@ -810,11 +832,9 @@ HRESULT CPlayer::Behavior_CombatExitCheck()
|
||||
m_eSpell = STATEANIM::END;
|
||||
return E_FAIL;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_pFSM->IsEnable(FSMSTATE::ANCIENT_THROW))
|
||||
{
|
||||
if (SUCCEEDED(InputMove()) && IsCurrentKeyFrame("Throw")) {
|
||||
@@ -845,6 +865,86 @@ void CPlayer::Behavior_CombatExit()
|
||||
FSMSTATE::SKILL2 | FSMSTATE::MAPHELP | FSMSTATE::ANCIENT_THROW | FSMSTATE::POTION);
|
||||
}
|
||||
|
||||
void CPlayer::Behavior_HitEnter()
|
||||
{
|
||||
m_pFSM->Enable_State(FSMSTATE::HIT);
|
||||
pair<_uint, _bool> pairAnimInfo;
|
||||
std::random_device rd;
|
||||
std::mt19937 mt(rd());
|
||||
std::uniform_int_distribution<int> Index(0, 1);
|
||||
auto RandIndex = Index(mt);
|
||||
if (RandIndex == 0)
|
||||
pairAnimInfo = m_Animation[STATEANIM::HIT_R];
|
||||
else
|
||||
pairAnimInfo = m_Animation[STATEANIM::HIT_L];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
|
||||
HRESULT CPlayer::Behavior_HitExitCheck()
|
||||
{
|
||||
if (m_pModelCom->IsFinishedAnim()) {
|
||||
m_pFSM->Change_State(FSMSTATE::IDLE);
|
||||
return E_FAIL;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
void CPlayer::Behavior_HitExit()
|
||||
{
|
||||
m_pFSM->Disable_State(FSMSTATE::HIT);
|
||||
}
|
||||
|
||||
void CPlayer::Behavior_Broom_RideEnter()
|
||||
{
|
||||
m_pFSM->Enable_State(FSMSTATE::BROOM_RIDE);
|
||||
pair<_uint, _bool> pairAnimInfo;
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_MOUNT];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
|
||||
HRESULT CPlayer::Behavior_Broom_RideExitCheck()
|
||||
{
|
||||
_uint iCurrAnimIndex = m_pModelCom->Get_AnimIndex();
|
||||
|
||||
if (iCurrAnimIndex == m_Animation[STATEANIM::BROOM_MOUNT].first)
|
||||
{
|
||||
if (m_pModelCom->IsFinishedAnim()) {
|
||||
pair<_uint, _bool> pairAnimInfo;
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_MOUNT_END];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, true);
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
/*if (m_pModelCom->IsFinishedAnim()) {
|
||||
m_pFSM->Change_State(FSMSTATE::IDLE);
|
||||
return E_FAIL;
|
||||
}*/
|
||||
|
||||
if (SUCCEEDED(InputMove()))
|
||||
{
|
||||
pair<_uint, _bool> pairAnimInfo;
|
||||
pairAnimInfo = Get_AnimInfo(STATEANIM::BROOM_HOVER_IDLE);
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
else
|
||||
{
|
||||
pair<_uint, _bool> pairAnimInfo;
|
||||
pairAnimInfo = Get_AnimInfo(STATEANIM::BROOM_HOVER_IDLE);
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
|
||||
if (m_pGameInstance->Key_Down(DIK_N)) {
|
||||
m_pFSM->Change_State(FSMSTATE::IDLE);
|
||||
return E_FAIL;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
void CPlayer::Behavior_Broom_RideExit()
|
||||
{
|
||||
m_pFSM->Disable_State(FSMSTATE::BROOM_RIDE);
|
||||
}
|
||||
|
||||
void CPlayer::Player_InterpTurn(_float fTimeDelta)
|
||||
{
|
||||
_uint iCurrIndex = m_pModelCom->Get_AnimIndex();
|
||||
@@ -915,7 +1015,15 @@ void CPlayer::Add_FSM()
|
||||
Desc.funcEnterEvent = [this]() { Behavior_IdleEnter(); };
|
||||
Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_IdleExitCheck(fTimedelta); };
|
||||
Desc.funcExitEvent = [this]() { Behavior_IdleExit(); };
|
||||
Desc.funcPriorityUpdate = nullptr;
|
||||
Desc.funcPriorityUpdate = [this](_float fTimeDelta) {
|
||||
{
|
||||
if (SUCCEEDED(InputAim()))
|
||||
{
|
||||
_float3 fMove = m_pGameInstance->Get_MouseMove();
|
||||
m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta * fMove.x * 0.05f);
|
||||
}
|
||||
}
|
||||
};
|
||||
Desc.funcLateUpdate = nullptr;
|
||||
m_States.emplace(FSMSTATE::IDLE, CState_Idle::Create(&Desc));
|
||||
}
|
||||
@@ -926,19 +1034,13 @@ void CPlayer::Add_FSM()
|
||||
Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_MoveExitCheck(fTimedelta); };
|
||||
Desc.funcExitEvent = [this]() { Behavior_MoveExit(); };
|
||||
Desc.funcPriorityUpdate = [this](_float fTimeDelta) {
|
||||
_vector xmvRight = XMVector4Normalize(XMVectorSetY(m_pTransformCom->Get_State(STATE::RIGHT), 0.f));
|
||||
_vector xmvPlayerDir = { };
|
||||
|
||||
{
|
||||
if (!m_pFSM->IsEnable(FSMSTATE::STOP))
|
||||
{
|
||||
_float3 fMove = m_pGameInstance->Get_MouseMove();
|
||||
m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta * fMove.x * 0.05f);
|
||||
m_pTransformCom->Turn(-m_pTransformCom->Get_State(STATE::UP), fTimeDelta * fMove.y * 0.05f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
Desc.funcLateUpdate = nullptr;
|
||||
@@ -992,6 +1094,42 @@ void CPlayer::Add_FSM()
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Behavior_Broom_Ride
|
||||
{
|
||||
CState_Broom_Ride::STATE_BROOM_RIDE_DESC Desc{};
|
||||
Desc.pOwner = this;
|
||||
Desc.funcEnterEvent = [this]() { Behavior_Broom_RideEnter(); };
|
||||
Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_Broom_RideExitCheck(); };
|
||||
Desc.funcExitEvent = [this]() { Behavior_Broom_RideExit(); };
|
||||
Desc.funcPriorityUpdate = [this](_float fTimeDelta) {
|
||||
if (m_pGameInstance->Key_Pressing(DIK_W))
|
||||
{
|
||||
_float3 fMove = m_pGameInstance->Get_MouseMove();
|
||||
m_pBroomTransform->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta * fMove.x * 0.03f);
|
||||
}
|
||||
_matrix BroomWorld = XMLoadFloat4x4(m_pBroomTransform->Get_WorldMatrixPtr());
|
||||
_matrix BoneLocal = XMLoadFloat4x4(m_pBroomModel->Get_BoneMatrixPtr("broomSocket"));
|
||||
|
||||
XMVECTOR Scale, Rot, Trans;
|
||||
XMMatrixDecompose(&Scale, &Rot, &Trans, BoneLocal);
|
||||
|
||||
_matrix BoneNoScale = XMMatrixRotationQuaternion(Rot) * XMMatrixTranslationFromVector(Trans);
|
||||
static _float3 OffsetPos = { 0.f, 0.f, 0.f };
|
||||
GUI::DragFloat3("BroomOffset", (_float*)&OffsetPos, 0.01f);
|
||||
_matrix Offset = XMMatrixTranslation(OffsetPos.x,
|
||||
OffsetPos.y, OffsetPos.z);
|
||||
|
||||
_matrix SocketWorld = BoneNoScale * Offset* BroomWorld;
|
||||
|
||||
m_pTransformCom->Set_WorldMatrix(SocketWorld);
|
||||
m_pCharacter_Controller->Set_Position(SocketWorld.r[3]);
|
||||
};
|
||||
Desc.funcLateUpdate = nullptr;
|
||||
m_States.emplace(FSMSTATE::BROOM_RIDE, CState_Broom_Ride::Create(&Desc));
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
void CPlayer::Set_Anim()
|
||||
@@ -1027,23 +1165,40 @@ void CPlayer::Set_Anim()
|
||||
|
||||
m_Animation[STATEANIM::LAND] = { 259,false };
|
||||
|
||||
m_Animation[STATEANIM::DODGE] = { 802,false };
|
||||
m_Animation[STATEANIM::DODGE_BLINK] = { 799,true };
|
||||
m_Animation[STATEANIM::DODGE] = { 878,false };
|
||||
m_Animation[STATEANIM::DODGE_BLINK] = { 876,true };
|
||||
|
||||
m_Animation[STATEANIM::SKILL] = { 593,false };
|
||||
m_Animation[STATEANIM::SKILL2] = { 915,false };
|
||||
m_Animation[STATEANIM::SKILL2] = { 991,false };
|
||||
m_Animation[STATEANIM::LIGHT_ATTACK] = { 413,false };
|
||||
m_Animation[STATEANIM::SPELL] = { 696,false };
|
||||
m_Animation[STATEANIM::SPELL] = { 772,false };
|
||||
m_Animation[STATEANIM::MAPHELP] = { 122,false };
|
||||
m_Animation[STATEANIM::POTION] = { 114,false };
|
||||
m_Animation[STATEANIM::ACCIO] = { 417,false };
|
||||
m_Animation[STATEANIM::DESCENDO] = { 418,false };
|
||||
m_Animation[STATEANIM::DEPULSO] = { 782,false };
|
||||
m_Animation[STATEANIM::DIFFINDO] = { 786,false };
|
||||
m_Animation[STATEANIM::LUMOS] = { 782,false };
|
||||
m_Animation[STATEANIM::DESCENDO] = { 857,false };
|
||||
m_Animation[STATEANIM::DEPULSO] = { 858,false };
|
||||
m_Animation[STATEANIM::DIFFINDO] = { 862,false };
|
||||
m_Animation[STATEANIM::LUMOS] = { 851,false };
|
||||
m_Animation[STATEANIM::DISILLUSION_ENTER] = { 585,false };
|
||||
m_Animation[STATEANIM::DISILLUSION_EXIT] = { 586,false };
|
||||
m_Animation[STATEANIM::ANCIENT_THROW] = { 843,false };
|
||||
m_Animation[STATEANIM::ANCIENT_THROW] = { 919,false };
|
||||
|
||||
|
||||
m_Animation[STATEANIM::HIT_L] = { 1124,false };
|
||||
m_Animation[STATEANIM::HIT_R] = { 1125,false };
|
||||
|
||||
m_Animation[STATEANIM::BROOM_IDLE] = { 679,true };
|
||||
m_Animation[STATEANIM::BROOM_FWD] = { 680,true };
|
||||
|
||||
m_Animation[STATEANIM::BROOM_MOUNT] = { 734,false };
|
||||
m_Animation[STATEANIM::BROOM_MOUNT_END] = { 737,false };
|
||||
m_Animation[STATEANIM::BROOM_HOVER_START] = { 699,false };
|
||||
m_Animation[STATEANIM::BROOM_HOVER_IDLE] = { 703,true };
|
||||
|
||||
|
||||
m_Animation[STATEANIM::JOG_AIM_STOP_L] = { 295,false };
|
||||
m_Animation[STATEANIM::JOG_AIM_STOP_R] = { 456,false };
|
||||
m_Animation[STATEANIM::JOG_AIM_STOP_BWD] = { 444,false };
|
||||
}
|
||||
#pragma endregion State
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#include "pch.h"
|
||||
#include "State_Broom_Ride.h"
|
||||
#include "Unit.h"
|
||||
|
||||
|
||||
CState_Broom_Ride::CState_Broom_Ride()
|
||||
:CState_Root()
|
||||
{
|
||||
}
|
||||
|
||||
void CState_Broom_Ride::Enter()
|
||||
{
|
||||
__super::Enter();
|
||||
}
|
||||
|
||||
HRESULT CState_Broom_Ride::Update(_float fTimeDelta)
|
||||
{
|
||||
if (nullptr != m_funcPriorityUpdate) {
|
||||
m_funcPriorityUpdate(fTimeDelta);
|
||||
}
|
||||
if (E_FAIL == (__super::Update(fTimeDelta))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (nullptr != m_funcLateUpdate) {
|
||||
m_funcLateUpdate(fTimeDelta);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CState_Broom_Ride::Exit()
|
||||
{
|
||||
__super::Exit();
|
||||
}
|
||||
|
||||
HRESULT CState_Broom_Ride::Initialize(STATE_BROOM_RIDE_DESC* pDesc)
|
||||
{
|
||||
if (FAILED(__super::Initialize(pDesc))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
m_funcPriorityUpdate = pDesc->funcPriorityUpdate;
|
||||
m_funcLateUpdate = pDesc->funcLateUpdate;
|
||||
m_pModel = m_pOwner->Get_Component<CModel>();
|
||||
m_pFSM = m_pOwner->Get_Component<CFSM>();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CState_Broom_Ride* CState_Broom_Ride::Create(STATE_BROOM_RIDE_DESC* pDesc)
|
||||
{
|
||||
CState_Broom_Ride* pInstance = new CState_Broom_Ride;
|
||||
if (FAILED(pInstance->Initialize(pDesc))) {
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CState_Broom_Ride::Free()
|
||||
{
|
||||
__super::Free();
|
||||
}
|
||||
|
||||
void CState_Broom_Ride::Describe_Entity()
|
||||
{
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Client_Define.h"
|
||||
#include "GameObject.h"
|
||||
#include "Unit.h"
|
||||
|
||||
NS_BEGIN(Client)
|
||||
|
||||
class CBroom final : public CGameObject
|
||||
class CBroom final : public CUnit
|
||||
{
|
||||
private:
|
||||
CBroom(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
@@ -21,14 +21,8 @@ class CBroom final : public CGameObject
|
||||
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 };
|
||||
|
||||
_bool m_bSprintToggle = { false };
|
||||
_bool m_bWalkToggle = { false };
|
||||
private:
|
||||
HRESULT Ready_Components();
|
||||
HRESULT Bind_ShaderResources();
|
||||
@@ -41,6 +35,31 @@ class CBroom final : public CGameObject
|
||||
virtual void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
|
||||
#pragma region STATE
|
||||
virtual void Add_FSM();
|
||||
virtual void Set_Anim();
|
||||
|
||||
_float m_fAmount = { 1.f };
|
||||
_float m_fInputTime = {};
|
||||
_bool m_bRatio = { false };
|
||||
|
||||
HRESULT InputAction();
|
||||
HRESULT InputMove();
|
||||
HRESULT InputKeyUpMove();
|
||||
HRESULT InputSpell();
|
||||
HRESULT InputAim();
|
||||
|
||||
void Behavior_IdleEnter();
|
||||
HRESULT Behavior_IdleExitCheck(_float fTimeDelta);
|
||||
void Behavior_IdleExit();
|
||||
|
||||
void Behavior_MoveEnter();
|
||||
HRESULT Behavior_MoveExitCheck(_float fTimeDelta);
|
||||
void Behavior_MoveExit();
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
};
|
||||
|
||||
NS_END
|
||||
|
||||
@@ -18,6 +18,7 @@ class CLevel_GamePlay final : public CLevel
|
||||
|
||||
private:
|
||||
class CInfoInstance* m_pInfoInstance = { nullptr };
|
||||
class CBroom* m_pBroom = { nullptr };
|
||||
private:
|
||||
virtual HRESULT Initialize() override;
|
||||
HRESULT Initialize(void* pArg);
|
||||
|
||||
@@ -42,6 +42,9 @@ class CPlayer final : public CUnit
|
||||
CRigidBody_Dynamic* m_pRigidBody = { nullptr };
|
||||
class CCallBack_Playable_Behavior* m_pCallBack_Behavior = { nullptr };
|
||||
class CCallBack_Playable_HitReport* m_pCallBack_HitReport = { nullptr };
|
||||
|
||||
class CModel* m_pBroomModel = { nullptr };
|
||||
class CTransform* m_pBroomTransform = { nullptr };
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
@@ -75,8 +78,6 @@ class CPlayer final : public CUnit
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void TestKeyInput(_float fTimeDelta);
|
||||
virtual void Add_FSM();
|
||||
virtual void Set_Anim();
|
||||
@@ -115,6 +116,14 @@ class CPlayer final : public CUnit
|
||||
HRESULT Behavior_CombatExitCheck();
|
||||
void Behavior_CombatExit();
|
||||
|
||||
void Behavior_HitEnter();
|
||||
HRESULT Behavior_HitExitCheck();
|
||||
void Behavior_HitExit();
|
||||
|
||||
void Behavior_Broom_RideEnter();
|
||||
HRESULT Behavior_Broom_RideExitCheck();
|
||||
void Behavior_Broom_RideExit();
|
||||
|
||||
|
||||
void Player_InterpTurn(_float fTimeDelta);
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include "Client_Define.h"
|
||||
#include "State_Root.h"
|
||||
|
||||
NS_BEGIN(Client)
|
||||
|
||||
class CState_Broom_Ride final : public CState_Root
|
||||
{
|
||||
public:
|
||||
typedef struct tagBroomRide : public CState_Root::STATE_ROOT_DESC {
|
||||
function<void(_float fTimeDelta)> funcPriorityUpdate = { nullptr };
|
||||
function<void(_float fTimeDelta)> funcLateUpdate = { nullptr };
|
||||
}STATE_BROOM_RIDE_DESC;
|
||||
private:
|
||||
CState_Broom_Ride();
|
||||
virtual ~CState_Broom_Ride() = default;
|
||||
|
||||
public:
|
||||
virtual void Enter();
|
||||
virtual HRESULT Update(_float fTimeDelta);
|
||||
virtual void Exit();
|
||||
|
||||
private:
|
||||
function<void(_float fTimeDelta)> m_funcPriorityUpdate = { nullptr };
|
||||
function<void(_float fTimeDelta)> m_funcLateUpdate = { nullptr };
|
||||
|
||||
private:
|
||||
HRESULT Initialize(STATE_BROOM_RIDE_DESC* pDesc);
|
||||
|
||||
public:
|
||||
static CState_Broom_Ride* Create(STATE_BROOM_RIDE_DESC* pDesc);
|
||||
virtual void Free() override;
|
||||
virtual void Describe_Entity();
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -43,7 +43,7 @@ void CBroom::Update(_float fTimeDelta)
|
||||
|
||||
void CBroom::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
|
||||
HRESULT CBroom::Render()
|
||||
@@ -59,9 +59,14 @@ HRESULT CBroom::Render()
|
||||
|
||||
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))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -630,6 +630,22 @@ void CLevel_ObjectViewer::Load_KeyFrame(const _char* Name)
|
||||
|
||||
void CLevel_ObjectViewer::Find_Anim()
|
||||
{
|
||||
GUI::InputInt("FindAnimIndex", &m_iAnimIndex);
|
||||
|
||||
if (!m_Objects.empty())
|
||||
{
|
||||
CModel* pModel = m_Objects[m_iObjectIndex]->Get_Component<CModel>();
|
||||
if (m_iAnimIndex <= pModel->Get_AnimSize())
|
||||
{
|
||||
if (GUI::Button(pModel->Get_AnimList(m_iAnimIndex)))
|
||||
{
|
||||
pModel->Set_AnimationIndex(m_iAnimIndex);
|
||||
pModel->Set_CurrentTrackPosition(0.f);
|
||||
pModel->Play_Animation(0.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUI::InputText("FindAnim", m_FindAnimName, sizeof(m_FindAnimName));
|
||||
|
||||
if (!m_Objects.empty())
|
||||
@@ -648,6 +664,7 @@ void CLevel_ObjectViewer::Find_Anim()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CLevel_ObjectViewer::Save_KeyFrame()
|
||||
@@ -737,8 +754,8 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_Dummy(const _wstring& strLayerTag)
|
||||
/*if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CGoblin>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, m_Test)))
|
||||
return E_FAIL;*/
|
||||
|
||||
/*if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CBroom>(g_iStaticLevel, NEXT_LEVEL, strLayerTag)))
|
||||
return E_FAIL;*/
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CBroom>(g_iStaticLevel, NEXT_LEVEL, strLayerTag)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -1615,7 +1615,7 @@ HRESULT CLoader::Loading_For_ObjectViewer()
|
||||
TEXT("Prototype_Component_Wand_Model")
|
||||
));
|
||||
futures.emplace_back(Deferred_ModelLoad(
|
||||
MODEL::ANIM, "../Bin/Resources/Models/Object/Broom/Broom.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity(),
|
||||
MODEL::ANIM, "../Bin/Resources/Models/Object/Broom/Broom.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixRotationY(XMConvertToRadians(180.f))* XMMatrixIdentity(),
|
||||
TEXT("Prototype_Component_Broom_Model")
|
||||
));
|
||||
futures.emplace_back(Deferred_ModelLoad(
|
||||
|
||||
@@ -57,6 +57,7 @@ class CLevel_ObjectViewer final : public CLevel
|
||||
_char m_DummyPath[MAX_PATH];
|
||||
_char m_FindAnimName[256] = {};
|
||||
string m_SelectedKey;
|
||||
_int m_iAnimIndex = {};
|
||||
|
||||
class CPlayer* m_Test = { nullptr };
|
||||
public:
|
||||
|
||||
@@ -33,7 +33,7 @@ CAnimation::CAnimation(const CAnimation& rhs)
|
||||
SAFE_ADDREF(pChannel);
|
||||
}
|
||||
}
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta,_vector vector[3], _float m_fAmount)
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta,_vector vector[3])
|
||||
{
|
||||
m_fProgress = m_fTickPerSecond * fTimeDelta * m_fAnimSpeed;
|
||||
m_fCurrentTrackPosition += m_fProgress;
|
||||
@@ -48,12 +48,12 @@ _bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bone
|
||||
Depart_Animation();
|
||||
m_fCurrentTrackPosition = m_fProgress;
|
||||
ResetRootMotion();
|
||||
ProgressAnimation(Bones, pLocalPosArray, vector, m_fAmount);
|
||||
ProgressAnimation(Bones, pLocalPosArray, vector);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ProgressAnimation(Bones, pLocalPosArray, vector, m_fAmount);
|
||||
ProgressAnimation(Bones, pLocalPosArray, vector);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -309,14 +309,14 @@ HRESULT CAnimation::Initialize(const vector<CBone*>& Bones, const CModel* pModel
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CAnimation::ProgressAnimation(const vector<CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray,_vector vector[3], _float m_fAmount)
|
||||
void CAnimation::ProgressAnimation(const vector<CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray,_vector vector[3])
|
||||
{
|
||||
_uint iIndex = {};
|
||||
if (m_vBoneTransformationMatrix.size() > 0) {
|
||||
m_vBoneTransformationMatrix.clear();
|
||||
}
|
||||
for (auto& pChannel : m_Channels) {
|
||||
pChannel->Update_TransformationMatirx(Bones, pLocalPosArray, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++], vector, m_fAmount);
|
||||
pChannel->Update_TransformationMatirx(Bones, pLocalPosArray, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++], vector);
|
||||
m_vBoneTransformationMatrix.push_back(pChannel->Get_BoneTransformationMatrix());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ void CChannel::Update_TransformationMatirx(
|
||||
const LOCALPOS_DESC* pLocalPosArray,
|
||||
_float fCurrentTrackPosition,
|
||||
_uint* pCurrentKeyFrameIndex,
|
||||
_vector vector[3],_float m_fAmount)
|
||||
_vector vector[3])
|
||||
{
|
||||
const LOCALPOS_DESC& LocalPos = pLocalPosArray[m_iBoneIndex];
|
||||
|
||||
@@ -133,17 +133,14 @@ void CChannel::Update_TransformationMatirx(
|
||||
vector[0] = vScale;
|
||||
vector[1] = vRotation;
|
||||
vector[2] = vTranslation;
|
||||
vTranslation = XMVectorZero();
|
||||
}
|
||||
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CChannel::ResetRootMotion()
|
||||
{
|
||||
m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
|
||||
@@ -142,8 +142,7 @@ _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, m_vector, m_fAmount);
|
||||
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, m_vector);
|
||||
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
}
|
||||
@@ -284,7 +283,7 @@ void CModel::Initialize_RootBone()
|
||||
{
|
||||
for (_uint i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
{
|
||||
if (m_Bones[i]->Compare_Name("Reference"))
|
||||
if (m_Bones[i]->Compare_Name("Reference") || m_Bones[i]->Compare_Name("root"))
|
||||
{
|
||||
m_iRootBoneIndex = i;
|
||||
}
|
||||
@@ -1029,6 +1028,17 @@ void CModel::ComputeAnimation()
|
||||
m_pLocalPos = static_cast<LOCALPOS_DESC*>(outSubs[0].pData);
|
||||
}
|
||||
|
||||
void CModel::InItialize_SpineIndex()
|
||||
{
|
||||
for (_uint i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
{
|
||||
if (m_Bones[i]->Compare_Name("Spine"))
|
||||
{
|
||||
m_iSpineIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HRESULT CModel::Create_ParentVB()
|
||||
{
|
||||
@@ -1416,6 +1426,7 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
if (m_eType == MODEL::ANIM)
|
||||
{
|
||||
Initialize_RootBone();
|
||||
InItialize_SpineIndex();
|
||||
Create_Temp();
|
||||
m_Parent.resize(m_Bones.size());
|
||||
for (size_t i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
|
||||
@@ -11,8 +11,8 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
CAnimation(const CAnimation& rhs);
|
||||
virtual ~CAnimation() = default;
|
||||
public:
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta, _vector vector[3], _float m_fAmount = 1.f);
|
||||
void ProgressAnimation(const vector<CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _vector vector[3], _float m_fAmount);
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta, _vector vector[3]);
|
||||
void ProgressAnimation(const vector<CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _vector vector[3]);
|
||||
void ResetRootMotion();
|
||||
void Depart_Animation();
|
||||
void Set_AnimPause(_bool bValue) { m_bPause = bValue; }
|
||||
|
||||
@@ -23,7 +23,7 @@ class ENGINE_DLL CChannel : public CBase
|
||||
CHANNEL_DESC Fill_GPU_ChannelDesc();
|
||||
|
||||
public:
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex, _vector vector[3],_float m_fAmount = 1.f);
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex, _vector vector[3]);
|
||||
_int Get_BoneIndex() { return { m_iBoneIndex }; }
|
||||
void Set_BoneIndex(_int iBoneIndex) { m_iBoneIndex = iBoneIndex; }
|
||||
void ResetRootMotion();
|
||||
|
||||
@@ -22,6 +22,8 @@ enum ESTATE : _u64Flag
|
||||
MAPHELP = 1ULL << 15,
|
||||
POTION = 1ULL << 16,
|
||||
STOP = 1ULL << 17,
|
||||
HIT = 1ULL << 18,
|
||||
BROOM_RIDE = 1ULL << 19,
|
||||
END
|
||||
};
|
||||
NS_END
|
||||
|
||||
@@ -32,7 +32,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
||||
#pragma endregion
|
||||
#pragma region Animation
|
||||
_bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr ); // 애니메이션에 델타타임을 넣어줌
|
||||
_bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌
|
||||
void Set_AnimationIndex(_uint iIndex, _bool isLoop = true, _float fAmount = 1.f, _bool bRatio = false);
|
||||
_bool IsFinishedAnim() const { return m_bIsFinishedAnim; }
|
||||
_bool IsLoopAnim() const { return m_bIsLoop; }
|
||||
@@ -71,6 +71,7 @@ void Combined_BoneMatrix();
|
||||
#pragma endregion
|
||||
|
||||
void ComputeAnimation();
|
||||
void InItialize_SpineIndex();
|
||||
|
||||
public:
|
||||
#ifdef EDITOR_PROJECT
|
||||
@@ -133,7 +134,8 @@ void Combined_BoneMatrix();
|
||||
_matrix m_DeltaAnimationMatrix = {}; // 루트본의 델타애니메이션
|
||||
class CTransform* m_pTransform = { nullptr }; // 모델 대상의 트랜스폼
|
||||
|
||||
_float m_fRatio = {};
|
||||
_float m_fRatio = {};
|
||||
_int m_iSpineIndex = { -1 };
|
||||
|
||||
// 바이너리
|
||||
SaveModel* m_pSaveModel = { nullptr };
|
||||
|
||||
@@ -7,7 +7,7 @@ enum ESTATE
|
||||
IDLE,IDLE_AIM, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD,
|
||||
MOVE,
|
||||
WALK, WALK_FWD,WALK_RIGHT,WALK_LEFT, WALK_BWD,WALK_STOP,
|
||||
JOG, JOG_FWD, JOG_RIGHT, JOG_LEFT, JOG_BWD, JOG_STOP, JOG_AIM_LEFT, JOG_AIM_RIGHT,JOG_AIM_BWD,
|
||||
JOG, JOG_FWD, JOG_RIGHT, JOG_LEFT, JOG_BWD, JOG_STOP, JOG_AIM_LEFT, JOG_AIM_RIGHT, JOG_AIM_BWD, JOG_AIM_STOP_L, JOG_AIM_STOP_R, JOG_AIM_STOP_BWD,
|
||||
SPRINT,
|
||||
JUMP,JUMP_JOG,JUMP_SPRINT,
|
||||
LAND,
|
||||
@@ -15,6 +15,7 @@ enum ESTATE
|
||||
COMBAT, LIGHT_ATTACK, SPELL, SKILL, SKILL2,
|
||||
MAPHELP,POTION,
|
||||
ACCIO,DESCENDO,DIFFINDO,DEPULSO,LUMOS,DISILLUSION_ENTER,DISILLUSION_EXIT, ANCIENT_THROW,
|
||||
BROOM_IDLE,BROOM_FWD, BROOM_HOVER_IDLE, BROOM_HOVER_START,BROOM_MOUNT, BROOM_MOUNT_END,
|
||||
HIT, HIT_FWD, HIT_BWD, HIT_BWD2, HIT_BWD3, HIT_BWD4, HIT_L, HIT_R,
|
||||
KNOCKDOWN, KNOCKDOWN_FWD, KNOCKDOWN_FWD_SPLT, KNOCKDOWN_FWD_SPLT_HOLD, KNOCKDOWN_BWD, KNOCKDOWN_BWD_SPLT, KNOCKDOWN_BWD_SPLT_HOLD,
|
||||
GETUP, GETUP_BWD, GETUP_FWD, GETUP_L, GETUP_L_FD, GETUP_L_FU, GETUP_R, GETUP_R_FD, GETUP_R_FU, GETUP_SLOUCH,
|
||||
@@ -22,7 +23,9 @@ enum ESTATE
|
||||
KNOCKBACK, KNOCKBACK2,
|
||||
TUMBLE, TUMBLE2,
|
||||
PETRIFICUSED_START,
|
||||
|
||||
////////////////////////// 빗자루
|
||||
BROOM_MOUNT_B, BROOM_HOVER_IDLE_B, BROOM_HOVER_STOP_B,BROOM_FLY_DOWN_B, BROOM_FLY_LEFT_B, BROOM_FLY_RIGHT_B, BROOM_FLY_UP_B,BROOM_FLY_B,
|
||||
/// ////////////////////////////
|
||||
END
|
||||
};
|
||||
NS_END
|
||||
|
||||
Reference in New Issue
Block a user