diff --git a/Jusin154_Team3D/Client/Private/Level_Field.cpp b/Jusin154_Team3D/Client/Private/Level_Field.cpp index d49249dc7..e6f834d07 100644 --- a/Jusin154_Team3D/Client/Private/Level_Field.cpp +++ b/Jusin154_Team3D/Client/Private/Level_Field.cpp @@ -99,6 +99,11 @@ void CLevel_Field::Update(_float fTimeDelta) } } + if (m_pGameInstance->Key_Up(DIK_7)) + { + _string strCutSceneName = "RanrokIntro"; + m_pInfoInstance->Active_Event(strCutSceneName); + } if (m_bLevel != m_bCurrentLevel) { diff --git a/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp b/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp index f9a7976fb..32b6f382e 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp @@ -84,7 +84,7 @@ void CRanrok_FireBall::Update(_float fTimeDelta) if (false == m_bHit) { _vector vStartPos = XMLoadFloat4(&m_vStartPos); _vector vEndPos = m_pFireBall->Get_WorldPostion(); - ON_COLLISION_INFO CollisionInfo = MonsterSweepTarget(vStartPos, vEndPos, 0.2f, true); + ON_COLLISION_INFO CollisionInfo = MonsterSweepTarget(vStartPos, vEndPos, 0.02f, true); OnCollision(this, &CollisionInfo); } diff --git a/Jusin154_Team3D/Client/Private/Troll.cpp b/Jusin154_Team3D/Client/Private/Troll.cpp index 6ac12d93a..61fd9d497 100644 --- a/Jusin154_Team3D/Client/Private/Troll.cpp +++ b/Jusin154_Team3D/Client/Private/Troll.cpp @@ -65,7 +65,7 @@ HRESULT CTroll::Initialize(void* pArg) - m_pCharacter_Controller->Set_Position(XMVectorSet(110.f, 24.f, 135.f, 1.f)); + m_pCharacter_Controller->Set_Position(XMVectorSet(96.927f, 15.f, 129.544f, 1.f)); m_pEffectPool = m_pGameInstance->Get_Layer(NEXT_LEVEL, TEXT("Layer_EffectPool"))->Get_Object(); SAFE_ADDREF(m_pEffectPool); diff --git a/Jusin154_Team3D/Client/Private/Troll_States.cpp b/Jusin154_Team3D/Client/Private/Troll_States.cpp index 6a1e99492..e6141656e 100644 --- a/Jusin154_Team3D/Client/Private/Troll_States.cpp +++ b/Jusin154_Team3D/Client/Private/Troll_States.cpp @@ -825,7 +825,8 @@ _bool CTroll::IsHitSpellDisabled() { if (m_eHitSpell == ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC) || m_eHitSpell == ENUM_CLASS(SKILL_TYPE::ANCIENT_MAGIC_THROW) || - m_eHitSpell == ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA)) + m_eHitSpell == ENUM_CLASS(SKILL_TYPE::AVADAKEDAVRA) || + m_eHitSpell == ENUM_CLASS(SKILL_TYPE::STUPEFY)) { return true; } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/AnimList/Player.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/AnimList/Player.xml index 2f52ba538..fd39eba00 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/AnimList/Player.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/AnimList/Player.xml @@ -134,7 +134,7 @@ - + diff --git a/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp index a31c75cdd..df032518f 100644 --- a/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp @@ -331,6 +331,8 @@ void CLevel_ObjectViewer::Show_AnimList() if (GUI::Button(pModel->Get_AnimList(i))) { pModel->Set_AnimationIndex(i); + m_iCurAnimIndex = i; + m_KeyFrames.clear(); } } } @@ -407,7 +409,11 @@ void CLevel_ObjectViewer::Dummy_Object_Setting() } _float AnimRatio = pModel->Get_CurrentTrackProgressRatio(); - GUI::DragFloat("AnimRatio", &AnimRatio); + if (GUI::DragFloat("AnimRatio", &AnimRatio, 0.001f)) + { + pModel->Set_CurrentTrackProgressRatio(AnimRatio); + } + _float AnimSpeed = pModel->Get_AnimSpeed(); GUI::DragFloat("AnimSpeed", &AnimSpeed, 0.1f); @@ -442,7 +448,7 @@ void CLevel_ObjectViewer::Dummy_Object_Setting() { if (pModel) { - _float fKeyFrame = pModel->Get_CurrentTrackPosition(); + _float fKeyFrame = pModel->Get_CurrentTrackProgressRatio(); m_KeyFrames.emplace(EventName, fKeyFrame); Save_KeyFrame(); @@ -669,6 +675,8 @@ void CLevel_ObjectViewer::Find_Anim() if (GUI::Button(pModel->Get_AnimList(m_iAnimIndex))) { pModel->Set_AnimationIndex(m_iAnimIndex); + m_iCurAnimIndex = m_iAnimIndex; + m_KeyFrames.clear(); } } @@ -683,6 +691,8 @@ void CLevel_ObjectViewer::Find_Anim() if (GUI::Button(pModel->Get_AnimList(i))) { pModel->Set_AnimationIndex(i); + m_iCurAnimIndex = i; + m_KeyFrames.clear(); } } } @@ -692,36 +702,66 @@ void CLevel_ObjectViewer::Find_Anim() void CLevel_ObjectViewer::Save_KeyFrame() { + _char szDrive[MAX_PATH] = {}; _char szDir[MAX_PATH] = {}; + _splitpath_s(m_DummyPath, szDrive, MAX_PATH, szDir, MAX_PATH, nullptr, 0, nullptr, 0); - _splitpath_s(m_DummyPath, nullptr, 0, szDir, MAX_PATH, nullptr, 0, nullptr, 0); + _string Path = _string(szDrive) + szDir + "KeyFrame.xml"; - _string szFile = "KeyFrame.bin"; - _string Path = szDir + szFile; + tinyxml2::XMLDocument doc; - FILE* fp = nullptr; - fopen_s(&fp, Path.c_str(), "wb"); - if (!fp) { - return; + tinyxml2::XMLElement* pRoot = nullptr; + if (doc.LoadFile(Path.c_str()) == tinyxml2::XML_SUCCESS) + pRoot = doc.FirstChildElement("KeyFrames"); + + if (!pRoot) + { + doc.Clear(); + pRoot = doc.NewElement("KeyFrames"); + doc.InsertFirstChild(pRoot); } - _uint KeyFrameSize = (_uint)m_KeyFrames.size(); + tinyxml2::XMLElement* pAnimNode = nullptr; + for (tinyxml2::XMLElement* pAnim = pRoot->FirstChildElement("Animation"); + pAnim; + pAnim = pAnim->NextSiblingElement("Animation")) + { + _int idx = -1; + pAnim->QueryIntAttribute("Index", &idx); - fwrite(&KeyFrameSize, sizeof(_uint), 1, fp); + if (idx == m_iCurAnimIndex) + { + pAnimNode = pAnim; + break; + } + } + + if (!pAnimNode) + { + pAnimNode = doc.NewElement("Animation"); + pAnimNode->SetAttribute("Index", m_iCurAnimIndex); + pRoot->InsertEndChild(pAnimNode); + } + + while (tinyxml2::XMLElement* pKey = pAnimNode->FirstChildElement("KeyFrame")) + { + pAnimNode->DeleteChild(pKey); + } for (auto& iter : m_KeyFrames) { - _uint EventSize = (_uint)iter.first.size(); - fwrite(&iter.second, sizeof(_float), 1, fp); - fwrite(&EventSize, sizeof(_uint), 1, fp); - fwrite(iter.first.c_str(), sizeof(_char), EventSize, fp); + tinyxml2::XMLElement* pKey = doc.NewElement("KeyFrame"); + pKey->SetAttribute("Event", iter.first.c_str()); + char buf[32]; + sprintf_s(buf, "%.3f", iter.second); + pKey->SetAttribute("Ratio", buf); + pKey->SetAttribute("Volume", m_fVolume); + pAnimNode->InsertEndChild(pKey); } - - fclose(fp); + doc.SaveFile(Path.c_str()); } - HRESULT CLevel_ObjectViewer::Ready_Layer_Camera(const _wstring& strLayerTag) { CCamera_Debug::CAMERA_DEBUG_DESC Camera_Desc{}; diff --git a/Jusin154_Team3D/Editor/Public/Level_ObjectViewer.h b/Jusin154_Team3D/Editor/Public/Level_ObjectViewer.h index c012eb67d..ee8c4d011 100644 --- a/Jusin154_Team3D/Editor/Public/Level_ObjectViewer.h +++ b/Jusin154_Team3D/Editor/Public/Level_ObjectViewer.h @@ -59,6 +59,8 @@ class CLevel_ObjectViewer final : public CLevel _char m_FindAnimName[256] = {}; string m_SelectedKey; _int m_iAnimIndex = {}; + _int m_iCurAnimIndex = {}; + _float m_fVolume = {0.f}; class CPlayer* m_Test = { nullptr }; public: diff --git a/Jusin154_Team3D/Engine/Private/Animation.cpp b/Jusin154_Team3D/Engine/Private/Animation.cpp index a77d863a2..42346d1f7 100644 --- a/Jusin154_Team3D/Engine/Private/Animation.cpp +++ b/Jusin154_Team3D/Engine/Private/Animation.cpp @@ -36,9 +36,13 @@ CAnimation::CAnimation(const CAnimation& rhs) } _bool CAnimation::Update_TransformationMatrices(const vector& Bones, _bool bIsLoop, _float fTimeDelta, _bool bIsSpine, vector<_uint> BoneMask, _float4& OutScale, _float4& OutRotation, _float4& OutTranslation, _int RootBoneIndex) { - m_fTempTrack += fTimeDelta * m_fAnimSpeed; - m_fProgress = m_fTickPerSecond * fTimeDelta * m_fAnimSpeed; - m_fCurrentTrackPosition += m_fProgress; + if (m_bPlayAnim) + { + m_fTempTrack += fTimeDelta * m_fAnimSpeed; + m_fProgress = m_fTickPerSecond * fTimeDelta * m_fAnimSpeed; + m_fCurrentTrackPosition += m_fProgress; + } + if (m_fCurrentTrackPosition >= m_fDuration) { if (false == bIsLoop) { @@ -345,10 +349,12 @@ void CAnimation::CreateGPUData(ID3D11Device* pDevice) void CAnimation::Set_CurrentTrackProgressRatio(_float fRatio) { fRatio = clamp(fRatio, 0.f, 1.f); - m_fTempTrack = fRatio * m_fDurationSeconds; + + m_fCurrentTrackPosition = m_fDuration * fRatio; } + #ifdef EDITOR_PROJECT diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index 685908fa7..a2db9cd90 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -196,10 +196,6 @@ void CModel::Set_ChainAnimation(pair<_uint, _bool> chainAnim) _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform) { - if (!m_bPlayAnim){ - return false; - } - if (m_iCurrentAnimIndex < 0 || m_iCurrentAnimIndex >= (_int)m_iNumAnimations){ return false; } @@ -872,6 +868,16 @@ _float CModel::Get_TrackProgressRatio(_uint iIndex) return m_Animations[iIndex]->Get_CurrentTrackProgressRatio(); } +void CModel::Set_PlayAnim(_bool bPlayAnim) +{ + m_Animations[m_iCurrentAnimIndex]->Set_PlayAnim(bPlayAnim); +} + +_bool CModel::Get_PlayAnim() +{ + return m_Animations[m_iCurrentAnimIndex]->Get_PlayAnim(); +} + _float CModel::Get_AnimSpeed() { return m_Animations[m_iCurrentAnimIndex]->Get_AnimSpeed(); diff --git a/Jusin154_Team3D/Engine/Public/Animation.h b/Jusin154_Team3D/Engine/Public/Animation.h index 64df874d6..282ad91b0 100644 --- a/Jusin154_Team3D/Engine/Public/Animation.h +++ b/Jusin154_Team3D/Engine/Public/Animation.h @@ -32,7 +32,7 @@ class ENGINE_DLL CAnimation : public CBase void Set_CurrentTrackPosition(_float TrackPosition) { m_fCurrentTrackPosition = TrackPosition; } _float Get_CurrentTrackPosition() { return m_fCurrentTrackPosition; } - _float Get_CurrentTrackProgressRatio() { return m_fTempTrack / m_fDurationSeconds;} + _float Get_CurrentTrackProgressRatio() { return m_fCurrentTrackPosition / m_fDuration;} void Set_CurrentTrackProgressRatio(_float fRatio); void Set_AnimSpeed(_float fSpeed) { m_fAnimSpeed = fSpeed; } _float Get_AnimSpeed() { return m_fAnimSpeed; } @@ -48,6 +48,8 @@ class ENGINE_DLL CAnimation : public CBase ID3D11ShaderResourceView* Get_ChannelSrv() { return m_pChannelSrv; } _float Get_Progress() { return m_fProgress; } + void Set_PlayAnim(_bool bPlay) { m_bPlayAnim = bPlay; } + _bool Get_PlayAnim() { return m_bPlayAnim; } #ifdef EDITOR_PROJECT private: HRESULT Initialize(const vector& Bones, const aiAnimation* pAIAnimation); @@ -88,6 +90,8 @@ class ENGINE_DLL CAnimation : public CBase vector m_StartKeyFrames; // 이 애니메이션의 영향을 받는 본들의 초기값 vector<_matrix> m_vBoneTransformationMatrix = {}; _float m_fProgress = {}; + _bool m_bPlayAnim = {true}; + _uint m_iChannelCount; _uint m_iKeyframeCount; diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h index 579d3124a..17717391a 100644 --- a/Jusin154_Team3D/Engine/Public/Model.h +++ b/Jusin154_Team3D/Engine/Public/Model.h @@ -93,8 +93,8 @@ class ENGINE_DLL CModel final : public CComponent _float Get_TrackProgressRatio(_uint iIndex); size_t Get_AnimSize() { return m_Animations.size(); } - void Set_PlayAnim(_bool bPlayAnim) { m_bPlayAnim = bPlayAnim; } - _bool Get_PlayAnim() const { return m_bPlayAnim; } + void Set_PlayAnim(_bool bPlayAnim); + _bool Get_PlayAnim(); _int Get_AnimIndex() const { return m_iCurrentAnimIndex; } _int Get_SecondAnimIndex() const { return m_iCurrSecondAnimIndex; } _float Get_AnimSpeed(); @@ -201,7 +201,6 @@ class ENGINE_DLL CModel final : public CComponent _bool m_bIsLoop = { false }; // 루프애니메이션인지 _bool m_bIsFinishedAnim = { false }; // 대상 애니메이션이 끝났는지 _bool m_bIsFinishedLerp = { false }; // 럴프 애니메이션이 끝났는지 - _bool m_bPlayAnim = { true }; _int m_iPreAnimIndex = { -1 }; _float m_fBlendTime = { 0.f };