2017-10-19 12:48:58 +08:00
|
|
|
|
#include "..\eactions.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-07 16:37:12 +08:00
|
|
|
|
e2d::ActionRotateBy::ActionRotateBy(float duration, float rotation) :
|
|
|
|
|
|
ActionGradual(duration)
|
2017-10-19 12:48:58 +08:00
|
|
|
|
{
|
|
|
|
|
|
m_nVariation = rotation;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-02-07 16:37:12 +08:00
|
|
|
|
void e2d::ActionRotateBy::_init()
|
2017-10-19 12:48:58 +08:00
|
|
|
|
{
|
2018-02-07 16:37:12 +08:00
|
|
|
|
ActionGradual::_init();
|
2017-10-20 00:59:26 +08:00
|
|
|
|
if (m_pTarget)
|
|
|
|
|
|
{
|
2017-11-03 12:51:01 +08:00
|
|
|
|
m_nBeginVal = m_pTarget->getRotation();
|
2017-10-20 00:59:26 +08:00
|
|
|
|
}
|
2017-10-19 12:48:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-02-07 16:37:12 +08:00
|
|
|
|
void e2d::ActionRotateBy::_update()
|
2017-10-19 12:48:58 +08:00
|
|
|
|
{
|
2018-02-07 16:37:12 +08:00
|
|
|
|
ActionGradual::_update();
|
2017-11-03 12:51:01 +08:00
|
|
|
|
|
2017-10-20 00:59:26 +08:00
|
|
|
|
if (m_pTarget == nullptr)
|
|
|
|
|
|
{
|
|
|
|
|
|
this->stop();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2017-11-03 12:51:01 +08:00
|
|
|
|
|
2018-01-30 16:45:38 +08:00
|
|
|
|
// <20><>ת<EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
|
m_pTarget->setRotation(m_nBeginVal + m_nVariation * m_fRateOfProgress);
|
2017-10-19 12:48:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-02-07 16:37:12 +08:00
|
|
|
|
e2d::ActionRotateBy * e2d::ActionRotateBy::clone() const
|
2017-10-19 12:48:58 +08:00
|
|
|
|
{
|
2018-02-07 16:37:12 +08:00
|
|
|
|
return new ActionRotateBy(m_fDuration, m_nVariation);
|
2017-10-19 12:48:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-02-07 16:37:12 +08:00
|
|
|
|
e2d::ActionRotateBy * e2d::ActionRotateBy::reverse() const
|
2017-10-19 12:48:58 +08:00
|
|
|
|
{
|
2018-02-07 16:37:12 +08:00
|
|
|
|
return new ActionRotateBy(m_fDuration, -m_nVariation);
|
2017-10-19 12:48:58 +08:00
|
|
|
|
}
|