Magic_Game/Easy2D/Action/EActionDelay.cpp

36 lines
589 B
C++
Raw Normal View History

2017-10-19 00:50:04 +08:00
#include "..\eactions.h"
#include "..\Win\winbase.h"
e2d::EActionDelay::EActionDelay(float duration)
2017-10-19 00:50:04 +08:00
{
setInterval(LONGLONG(duration * 1000));
}
e2d::EActionDelay * e2d::EActionDelay::clone() const
2017-10-19 00:50:04 +08:00
{
return new EActionDelay(m_nAnimationInterval / 1000.0f);
2017-10-19 00:50:04 +08:00
}
void e2d::EActionDelay::_init()
2017-10-19 00:50:04 +08:00
{
EAction::_init();
// <20><>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1>
m_tLast = GetNow();
2017-10-19 00:50:04 +08:00
}
void e2d::EActionDelay::_callOn()
2017-10-19 00:50:04 +08:00
{
// <20>ж<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>
if (GetInterval(m_tLast) > m_nAnimationInterval)
2017-10-19 00:50:04 +08:00
{
this->stop();
}
}
void e2d::EActionDelay::_reset()
2017-10-19 00:50:04 +08:00
{
EAction::_reset();
// <20><>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1>
m_tLast = GetNow();
2017-10-19 00:50:04 +08:00
}