| 1 |
#ifndef _CPLAYANIMATIONEVENT_ |
| 2 |
#define _CPLAYANIMATIONEVENT_ |
| 3 |
|
| 4 |
#include "CSequencedEvent.h" |
| 5 |
#include "CSprite.h" |
| 6 |
|
| 7 |
class CPlayAnimationEvent : public CSequencedEvent |
| 8 |
{ |
| 9 |
public: |
| 10 |
CPlayAnimationEvent(CSprite &s, const string &anim, bool concurrent = false) : CSequencedEvent(concurrent), s(s), anim(anim) {} |
| 11 |
|
| 12 |
void initialize() { s.setAnimation(anim); } |
| 13 |
void doUpdate() { if (s.getCurrentAnimation()->isDone()) setDone(); } |
| 14 |
CPlayAnimationEvent* getCopy() { return new CPlayAnimationEvent(*this); } |
| 15 |
|
| 16 |
private: |
| 17 |
CSprite &s; |
| 18 |
string anim; |
| 19 |
}; |
| 20 |
|
| 21 |
#endif |