DragonNest/Server/DNGameServer/MSActionPlayAni.cpp
2024-12-20 16:56:44 +08:00

62 lines
3.1 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "StdAfx.h"
#include "MSActionPlayAni.h"
#include "DnActor.h"
#include "DnSkillBase.h"
#include "DnDamagebase.h"
int MSActionPlayAni::ID = -1;
MSActionPlayAni::MSActionPlayAni()
{
m_fTimeDelta = 0.f;
}
MSActionPlayAni::~MSActionPlayAni()
{
}
void MSActionPlayAni::Execute( LOCAL_TIME LocalTime, float fDelta )
{
CDnSkillBase *pSkill = dynamic_cast<CDnSkillBase *>(this);
if( !pSkill ) return;
DnActorHandle hActor = pSkill->GetActor();
if( hActor ) {
MSUsingTypeBase *pUsingType = dynamic_cast<MSUsingTypeBase *>(pSkill);
if( pUsingType && pUsingType->GetMethodID() == MSPassiveHitCheckDamageAction::ID ) {
CDnDamageBase::SHitParam *pHitParam = hActor->GetHitParam();
pHitParam->szActionName = m_szActionName;
}
else {
hActor->SetMovable( false );
hActor->SetActionQueue( m_szActionName.c_str() );
}
CEtActionBase::ActionElementStruct *pStruct = hActor->GetElement( m_szActionName.c_str() );
if( pStruct == NULL ) return;
m_fTimeDelta = (float)pStruct->dwLength / s_fDefaultFps;
}
}
void MSActionPlayAni::Process( LOCAL_TIME LocalTime, float fDelta )
{
m_fTimeDelta -= fDelta;
if( m_fTimeDelta <= 0.f ) m_fTimeDelta = 0.f;
CDnSkillBase *pSkill = dynamic_cast<CDnSkillBase *>(this);
if( !pSkill ) return;
DnActorHandle hActor = pSkill->GetActor();
}
void MSActionPlayAni::Initialize( const char *szActionName )
{
m_szActionName = szActionName;
}
bool MSActionPlayAni::IsFinishAction()
{
if( m_fTimeDelta == 0.f ) return true;
return false;
}