Action新增getTarget函数,获取执行该动作的目标
This commit is contained in:
parent
388337bbef
commit
414cfc156c
|
|
@ -71,6 +71,11 @@ Action * Action::reverse() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Sprite * Action::getTarget()
|
||||
{
|
||||
return m_pTargetSprite;
|
||||
}
|
||||
|
||||
void Action::_reset()
|
||||
{
|
||||
m_bEnding = false;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ void Sprite::addAction(Action * action)
|
|||
|
||||
void Sprite::resumeAction(Action * action)
|
||||
{
|
||||
if (action->m_pTargetSprite == this)
|
||||
if (action->getTarget() == this)
|
||||
{
|
||||
ActionManager::resumeAction(action);
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ void Sprite::resumeAction(Action * action)
|
|||
|
||||
void Sprite::pauseAction(Action * action)
|
||||
{
|
||||
if (action->m_pTargetSprite == this)
|
||||
if (action->getTarget() == this)
|
||||
{
|
||||
ActionManager::pauseAction(action);
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ void Sprite::pauseAction(Action * action)
|
|||
|
||||
void Sprite::stopAction(Action * action)
|
||||
{
|
||||
if (action->m_pTargetSprite == this)
|
||||
if (action->getTarget() == this)
|
||||
{
|
||||
ActionManager::stopAction(action);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1101,6 +1101,8 @@ public:
|
|||
virtual Action * copy() const = 0;
|
||||
// 获取一个新的逆向动作
|
||||
virtual Action * reverse() const;
|
||||
// 获取执行该动作的目标
|
||||
virtual Sprite * getTarget();
|
||||
|
||||
protected:
|
||||
bool m_bRunning;
|
||||
|
|
|
|||
Loading…
Reference in New Issue