| 1 |
#include "CGotoAnimChangeEvent.h" |
| 2 |
#include "CGotoEvent.h" |
| 3 |
#include "exceptions.h" |
| 4 |
#include "utils.h" |
| 5 |
|
| 6 |
void CGotoAnimChangeEvent::doUpdate() |
| 7 |
{ |
| 8 |
if (!d) |
| 9 |
{ |
| 10 |
setDone(); |
| 11 |
return; |
| 12 |
} |
| 13 |
|
| 14 |
CGotoData* d2 = dynamic_cast<CGotoData*>(d); |
| 15 |
|
| 16 |
if (!d2) |
| 17 |
{ |
| 18 |
setDone(); |
| 19 |
return; |
| 20 |
} |
| 21 |
|
| 22 |
try |
| 23 |
{ |
| 24 |
if (d2->hitBottom() && d2->hitLeft()) |
| 25 |
{ |
| 26 |
b.setAnimation("hitanim_bottom_left"); |
| 27 |
} |
| 28 |
else if (d2->hitBottom() && d2->hitRight()) |
| 29 |
{ |
| 30 |
b.setAnimation("hitanim_bottom_right"); |
| 31 |
} |
| 32 |
else if (d2->hitTop() && d2->hitLeft()) |
| 33 |
{ |
| 34 |
b.setAnimation("hitanim_top_left"); |
| 35 |
} |
| 36 |
else if (d2->hitTop() && d2->hitRight()) |
| 37 |
{ |
| 38 |
b.setAnimation("hitanim_top_right"); |
| 39 |
} |
| 40 |
else if(d2->hitBottom()) |
| 41 |
{ |
| 42 |
b.setAnimation("hitanim_bottom"); |
| 43 |
} |
| 44 |
else if(d2->hitTop()) |
| 45 |
{ |
| 46 |
b.setAnimation("hitanim_top"); |
| 47 |
} |
| 48 |
else if(d2->hitLeft()) |
| 49 |
{ |
| 50 |
b.setAnimation("hitanim_left"); |
| 51 |
} |
| 52 |
else if(d2->hitRight()) |
| 53 |
{ |
| 54 |
b.setAnimation("hitanim_right"); |
| 55 |
} |
| 56 |
} |
| 57 |
catch (ex_illegalArguments e) |
| 58 |
{ |
| 59 |
LOG("failed to set animation of {" << this << "} (" << e.what() << ")", 5, LOG_INFO); |
| 60 |
} |
| 61 |
setDone(); |
| 62 |
} |