2017-10-19 00:50:04 +08:00
|
|
|
|
#include "..\eactions.h"
|
|
|
|
|
|
|
2017-10-19 12:47:36 +08:00
|
|
|
|
e2d::EActionTwo::EActionTwo(EAction * actionFirst, EAction * actionSecond) :
|
2017-10-19 12:48:58 +08:00
|
|
|
|
m_pFirstAction(actionFirst),
|
|
|
|
|
|
m_pSecondAction(actionSecond)
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
2017-10-19 12:48:58 +08:00
|
|
|
|
m_pFirstAction->retain();
|
|
|
|
|
|
m_pSecondAction->retain();
|
2017-10-19 00:50:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-19 12:47:36 +08:00
|
|
|
|
e2d::EActionTwo::~EActionTwo()
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
2017-10-19 12:48:58 +08:00
|
|
|
|
SafeRelease(&m_pFirstAction);
|
|
|
|
|
|
SafeRelease(&m_pSecondAction);
|
2017-10-19 00:50:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-19 12:48:58 +08:00
|
|
|
|
e2d::EActionTwo * e2d::EActionTwo::clone() const
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
2017-10-19 12:48:58 +08:00
|
|
|
|
return new EActionTwo(m_pFirstAction->clone(), m_pSecondAction->clone());
|
2017-10-19 00:50:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-19 12:47:36 +08:00
|
|
|
|
e2d::EActionTwo * e2d::EActionTwo::reverse(bool actionReverse) const
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (actionReverse)
|
|
|
|
|
|
{
|
2017-10-19 12:48:58 +08:00
|
|
|
|
return new EActionTwo(m_pSecondAction->reverse(), m_pFirstAction->reverse());
|
2017-10-19 00:50:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2017-10-19 12:48:58 +08:00
|
|
|
|
return new EActionTwo(m_pSecondAction->clone(), m_pFirstAction->clone());
|
2017-10-19 00:50:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-19 12:47:36 +08:00
|
|
|
|
void e2d::EActionTwo::_init()
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
EAction::_init();
|
2017-10-20 00:59:26 +08:00
|
|
|
|
if (!m_pFirstAction->getTarget() && m_pTarget)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pFirstAction->setTarget(m_pTarget);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!m_pSecondAction->getTarget() && m_pTarget)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_pSecondAction->setTarget(m_pTarget);
|
|
|
|
|
|
}
|
2017-10-19 00:50:04 +08:00
|
|
|
|
|
2017-10-19 12:48:58 +08:00
|
|
|
|
m_pFirstAction->_init();
|
2017-10-19 00:50:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-19 12:48:58 +08:00
|
|
|
|
void e2d::EActionTwo::_callOn()
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
2017-10-19 12:48:58 +08:00
|
|
|
|
if (!m_pFirstAction->_isEnding())
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
2017-10-19 12:48:58 +08:00
|
|
|
|
m_pFirstAction->_callOn();
|
|
|
|
|
|
if (m_pFirstAction->_isEnding())
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> true <20><>ʾ<EFBFBD><CABE>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>
|
2017-10-19 12:48:58 +08:00
|
|
|
|
m_pSecondAction->_init();
|
2017-10-19 00:50:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-10-19 12:48:58 +08:00
|
|
|
|
else if (!m_pSecondAction->_isEnding())
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
2017-10-19 12:48:58 +08:00
|
|
|
|
m_pSecondAction->_callOn();
|
2017-10-19 00:50:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this->stop();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-19 12:47:36 +08:00
|
|
|
|
void e2d::EActionTwo::_reset()
|
2017-10-19 00:50:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
EAction::_reset();
|
|
|
|
|
|
|
2017-10-19 12:48:58 +08:00
|
|
|
|
m_pFirstAction->_reset();
|
|
|
|
|
|
m_pSecondAction->_reset();
|
2017-10-19 00:50:04 +08:00
|
|
|
|
}
|