[Add] 대각선 이동 추가
This commit is contained in:
@@ -111,7 +111,7 @@ HRESULT CEffectPool::Bind_ShaderResources()
|
||||
HRESULT CEffectPool::Ready_Effect()
|
||||
{
|
||||
|
||||
if(FAILED(Create_Effect(SKILL_TYPE::JAP, 5, NEXT_LEVEL, NEXT_LEVEL, [&](_uint iPrototypeLevel, _uint iCloneLevel) -> CEffect_Container* {
|
||||
if(FAILED(Create_Effect(SKILL_TYPE::JAP, 10, NEXT_LEVEL, NEXT_LEVEL, [&](_uint iPrototypeLevel, _uint iCloneLevel) -> CEffect_Container* {
|
||||
|
||||
CNomalJap* pEffect = nullptr;
|
||||
|
||||
|
||||
@@ -351,7 +351,7 @@ _matrix CPlayer::Get_WandPos()
|
||||
if (pWand == nullptr)
|
||||
return _matrix();
|
||||
|
||||
_matrix BoneMatrix = XMLoadFloat4x4(m_pModelCom->Get_BoneMatrixPtr("root"));
|
||||
_matrix BoneMatrix = XMLoadFloat4x4(pWand->Get_BoneMatrixPtr("root"));
|
||||
|
||||
BoneMatrix = BoneMatrix * m_pTransformCom->Get_XMWorldMatrix();
|
||||
|
||||
|
||||
@@ -22,26 +22,6 @@
|
||||
|
||||
#include "EffectPool.h"
|
||||
|
||||
|
||||
_matrix CPlayer::Get_WandPos()
|
||||
{
|
||||
|
||||
m_
|
||||
|
||||
_matrix BoneMatrix = XMLoadFloat4x4(m_pModelCom->Get_BoneMatrixPtr("root"));
|
||||
|
||||
BoneMatrix = BoneMatrix * m_pTransformCom->Get_XMWorldMatrix();
|
||||
|
||||
|
||||
BoneMatrix.r[3] += XMVector3Normalize(BoneMatrix.r[0]) * m_vOffset.x;
|
||||
BoneMatrix.r[3] += XMVector3Normalize(BoneMatrix.r[1]) * m_vOffset.y;
|
||||
BoneMatrix.r[3] += XMVector3Normalize(BoneMatrix.r[2]) * m_vOffset.z;
|
||||
|
||||
m_pEffectParts->Get_Component<CTransform>()->Set_WorldMatrix(BoneMatrix);
|
||||
|
||||
return _matrix();
|
||||
}
|
||||
|
||||
#pragma region States
|
||||
|
||||
void CPlayer::TestKeyInput(_float fTimeDelta)
|
||||
@@ -131,10 +111,29 @@ HRESULT CPlayer::InputSpell()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CPlayer::InputAim()
|
||||
{
|
||||
if (m_pGameInstance->Mouse_Pressing(DIM_RBUTTON))
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
void CPlayer::Behavior_IdleEnter() {
|
||||
m_pFSM->Enable_State(FSMSTATE::IDLE);
|
||||
pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::IDLE];
|
||||
pair<_uint, _bool> pairAnimInfo;
|
||||
|
||||
if (SUCCEEDED(InputAim()))
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::IDLE_AIM];
|
||||
}
|
||||
else
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::IDLE];
|
||||
}
|
||||
|
||||
m_bSprintToggle = false;
|
||||
m_bWalkToggle = false;
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
@@ -244,11 +243,16 @@ HRESULT CPlayer::Behavior_IdleExitCheck(_float fTimeDelta)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (m_pModelCom->IsFinishedAnim())
|
||||
if (!SUCCEEDED(InputAim()))
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::IDLE];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
if (m_pModelCom->IsFinishedAnim())
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::IDLE];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -422,45 +426,6 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
|
||||
|
||||
_float cross = vCurLook.x * vInputDir.y - vCurLook.y * vInputDir.x;
|
||||
|
||||
_vector vCameraLook = XMVectorSet(m_vCameraLookDir.x, 0.f, m_vCameraLookDir.z, 0.f);
|
||||
|
||||
vCameraLook = XMVector3Normalize(vCameraLook);
|
||||
|
||||
_float2 fCamLook = { XMVectorGetX(vCameraLook), XMVectorGetZ(vCameraLook) };
|
||||
|
||||
_float angle = CMyTools::Get_Direction2D(vCurLook, fCamLook);
|
||||
|
||||
_float degree = XMConvertToDegrees(angle);
|
||||
if (m_pModelCom->Get_AnimIndex() == m_Animation[STATEANIM::JOG_FWD].first)
|
||||
{
|
||||
_float targetAngle = degree;
|
||||
|
||||
if (m_pGameInstance->Key_Pressing(DIK_W))
|
||||
targetAngle = 0.f;
|
||||
if (m_pGameInstance->Key_Pressing(DIK_D))
|
||||
targetAngle = 90.f;
|
||||
if (m_pGameInstance->Key_Pressing(DIK_A))
|
||||
targetAngle = -90.f;
|
||||
if (m_pGameInstance->Key_Pressing(DIK_S))
|
||||
targetAngle = 180.f;
|
||||
|
||||
_float angleDiff = degree - targetAngle;
|
||||
|
||||
if (angleDiff > 180.f) angleDiff -= 360.f;
|
||||
if (angleDiff < -180.f) angleDiff += 360.f;
|
||||
|
||||
_float threshold = 2.f;
|
||||
|
||||
if (angleDiff > threshold)
|
||||
{
|
||||
m_pTransformCom->Turn(-m_pTransformCom->Get_State(STATE::UP), fTimeDelta);
|
||||
}
|
||||
else if (angleDiff < -threshold)
|
||||
{
|
||||
m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
_bool bSkipAngleCheck = { false };
|
||||
if (m_pFSM->IsEnable(FSMSTATE::JOG)) {
|
||||
if (iCurrentAnimIndex != m_Animation[STATEANIM::JOG_FWD].first) {
|
||||
@@ -473,7 +438,7 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
|
||||
}
|
||||
if (!bSkipAngleCheck) {
|
||||
_float absDir = fabsf(vDir);
|
||||
if (absDir <= XMConvertToRadians(80.f)) {
|
||||
if (absDir <= XMConvertToRadians(90.f)) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::JOG_FWD];
|
||||
m_fAmount = 1.f;
|
||||
m_bRatio = true;
|
||||
@@ -500,6 +465,9 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second,m_fAmount, m_bRatio);
|
||||
}
|
||||
}
|
||||
|
||||
Player_InterpTurn(fTimeDelta);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -523,7 +491,6 @@ HRESULT CPlayer::Behavior_MoveExitCheck(_float fTimeDelta)
|
||||
}
|
||||
}
|
||||
else if (IsCurrentKeyFrame("TurnStop"))
|
||||
|
||||
{
|
||||
m_pFSM->Change_State(FSMSTATE::IDLE);
|
||||
m_pFSM->Disable_State(FSMSTATE::STOP);
|
||||
@@ -649,10 +616,11 @@ void CPlayer::Behavior_CombatEnter()
|
||||
else if (m_pGameInstance->Mouse_Up(DIM_LBUTTON)) {
|
||||
m_pFSM->Enable_State(FSMSTATE::LIGHT_ATTACK);
|
||||
pairAnimInfo = m_Animation[STATEANIM::LIGHT_ATTACK];
|
||||
m_pModelCom->Anim_Event(0.1f, m_Animation[STATEANIM::LIGHT_ATTACK].first, [this]() {
|
||||
m_pEffectPool->Use_Skill(SKILL_TYPE::JAP, this);
|
||||
/*m_pModelCom->Anim_Event(0.1f, m_Animation[STATEANIM::LIGHT_ATTACK].first, [this]() {
|
||||
m_pEffectPool->Use_Skill(SKILL_TYPE::JAP, this);
|
||||
return E_FAIL;
|
||||
});
|
||||
});*/
|
||||
}
|
||||
else if (SUCCEEDED(InputSpell())) {
|
||||
m_pFSM->Enable_State(FSMSTATE::SPELL);
|
||||
@@ -825,6 +793,63 @@ void CPlayer::Behavior_CombatExit()
|
||||
m_pFSM->Disable_State(FSMSTATE::COMBAT | FSMSTATE::LIGHT_ATTACK | FSMSTATE::SPELL | FSMSTATE::SKILL | FSMSTATE::SKILL2 | FSMSTATE::MAPHELP | FSMSTATE::ANCIENT_THROW);
|
||||
}
|
||||
|
||||
void CPlayer::Player_InterpTurn(_float fTimeDelta)
|
||||
{
|
||||
if (m_pModelCom->Get_AnimIndex() != m_Animation[STATEANIM::JOG_FWD].first)
|
||||
return;
|
||||
_vector xmvCurLook = XMVector4Normalize(
|
||||
XMVectorSetY(m_pTransformCom->Get_State(STATE::LOOK), 0.f));
|
||||
_float2 vCurLook = { XMVectorGetX(xmvCurLook),XMVectorGetZ(xmvCurLook) };
|
||||
|
||||
_vector vCameraLook = XMVectorSet(m_vCameraLookDir.x, 0.f, m_vCameraLookDir.z, 0.f);
|
||||
|
||||
_vector vCameraRight = XMVectorSet(m_vCameraRightDir.x, 0.f, m_vCameraRightDir.z, 0.f);
|
||||
|
||||
_float2 fCamLook = { XMVectorGetX(vCameraLook), XMVectorGetZ(vCameraLook) };
|
||||
|
||||
vCameraRight = XMVector3Normalize(vCameraRight);
|
||||
|
||||
_float angle = CMyTools::Get_Direction2D(vCurLook, fCamLook);
|
||||
|
||||
_float degree = XMConvertToDegrees(angle);
|
||||
|
||||
_vector xmvInput = XMVectorZero();
|
||||
|
||||
if (m_pGameInstance->Key_Pressing(DIK_W))
|
||||
xmvInput += vCameraLook;
|
||||
|
||||
if (m_pGameInstance->Key_Pressing(DIK_S))
|
||||
xmvInput -= vCameraLook;
|
||||
|
||||
if (m_pGameInstance->Key_Pressing(DIK_D))
|
||||
xmvInput -= vCameraRight;
|
||||
|
||||
if (m_pGameInstance->Key_Pressing(DIK_A))
|
||||
xmvInput += vCameraRight;
|
||||
|
||||
xmvInput = XMVector3Normalize(xmvInput);
|
||||
|
||||
_float2 fInput2D = { XMVectorGetX(xmvInput), XMVectorGetZ(xmvInput) };
|
||||
|
||||
_float targetAngle = XMConvertToDegrees(CMyTools::Get_Direction2D(fCamLook, fInput2D));
|
||||
|
||||
_float angleDiff = degree - targetAngle;
|
||||
|
||||
if (angleDiff > 180.f) angleDiff -= 360.f;
|
||||
if (angleDiff < -180.f) angleDiff += 360.f;
|
||||
|
||||
_float threshold = 2.f;
|
||||
|
||||
if (angleDiff > threshold)
|
||||
{
|
||||
m_pTransformCom->Turn(-m_pTransformCom->Get_State(STATE::UP), fTimeDelta);
|
||||
}
|
||||
else if (angleDiff < -threshold)
|
||||
{
|
||||
m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayer::Add_FSM()
|
||||
{
|
||||
#pragma region Behavior_Movement_NotFocus
|
||||
@@ -934,6 +959,7 @@ void CPlayer::Add_FSM()
|
||||
void CPlayer::Set_Anim()
|
||||
{
|
||||
m_Animation[STATEANIM::IDLE] = { 266,true };
|
||||
m_Animation[STATEANIM::IDLE_AIM] = { 5,true };
|
||||
m_Animation[STATEANIM::IDLE_TURN_L] = { 270,false };
|
||||
m_Animation[STATEANIM::IDLE_TURN_R] = { 430,false };
|
||||
m_Animation[STATEANIM::IDLE_TURN_BWD] = { 268,false };
|
||||
|
||||
@@ -89,6 +89,7 @@ class CPlayer final : public CUnit
|
||||
HRESULT InputMove();
|
||||
HRESULT InputKeyUpMove();
|
||||
HRESULT InputSpell();
|
||||
HRESULT InputAim();
|
||||
|
||||
void Behavior_IdleEnter();
|
||||
HRESULT Behavior_IdleExitCheck(_float fTimeDelta);
|
||||
@@ -114,6 +115,9 @@ class CPlayer final : public CUnit
|
||||
HRESULT Behavior_CombatExitCheck();
|
||||
void Behavior_CombatExit();
|
||||
|
||||
|
||||
void Player_InterpTurn(_float fTimeDelta);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
|
||||
@@ -723,8 +723,8 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_UI(const _wstring& strLayerTag)
|
||||
|
||||
HRESULT CLevel_ObjectViewer::Ready_Layer_Dummy(const _wstring& strLayerTag)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CPlayer>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, nullptr, nullptr, &m_Test)))
|
||||
return E_FAIL;
|
||||
/*if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CPlayer>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, nullptr, nullptr, &m_Test)))
|
||||
return E_FAIL;*/
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CDummySkyBox>(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE)))
|
||||
return E_FAIL;
|
||||
@@ -734,8 +734,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<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;*/
|
||||
|
||||
@@ -98,6 +98,15 @@ HRESULT CPlayer::InputSpell()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT CPlayer::InputAimMove()
|
||||
{
|
||||
if (m_pGameInstance->Mouse_Pressing(DIM_RBUTTON))
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
void CPlayer::Behavior_IdleEnter() {
|
||||
m_pFSM->Enable_State(FSMSTATE::IDLE);
|
||||
pair<_uint, _bool> pairAnimInfo = m_Animation[STATEANIM::IDLE];
|
||||
|
||||
@@ -61,6 +61,7 @@ class CPlayer final : public CUnit
|
||||
HRESULT InputAction();
|
||||
HRESULT InputMove();
|
||||
HRESULT InputSpell();
|
||||
HRESULT InputAimMove();
|
||||
|
||||
_float m_fAmount = { 1.f };
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
_int Get_AnimProgressPostion(const _char* pAnimChannelName);
|
||||
void Set_AnimProgressPostion(const _char* pChannelName, _uint iPosition);
|
||||
vector<_int>* Capture_Bones();
|
||||
void InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, float fRatio);
|
||||
void InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, _float fRatio);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ void Combined_BoneMatrix();
|
||||
|
||||
_int m_iPreAnimIndex = { -1 };
|
||||
_float m_fBlendTime = { 0.f };
|
||||
_float m_fBlendDuration = { 0.2f };
|
||||
_float m_fBlendDuration = { 0.3f };
|
||||
|
||||
_float m_fRadius = { 0.f }; // 컬링용 Radius
|
||||
_float3 m_vRadiusOffset = {}; // 컬링용 Radius Offset
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
NS_BEGIN(STATEANIM)
|
||||
enum ESTATE
|
||||
{
|
||||
IDLE, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD,
|
||||
IDLE,IDLE_AIM, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD,
|
||||
MOVE,
|
||||
WALK, WALK_FWD, WALK_BWD,WALK_STOP,
|
||||
JOG,JOG_FWD,JOG_RIGHT,JOG_LEFT, JOG_BWD,JOG_STOP,
|
||||
|
||||
Reference in New Issue
Block a user