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