diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-08 20:40:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-08 23:17:42 +0300 |
commit | 877bfe276efcf663de5a8af8fa9464aaf935ca2d (patch) | |
tree | d00a91bae411640ca57b8cf7b8b2559a2fc4c36c /src/effectmanager.cpp | |
parent | 894af147511679d9db979b8169540c3e922ce375 (diff) | |
download | manaverse-877bfe276efcf663de5a8af8fa9464aaf935ca2d.tar.gz manaverse-877bfe276efcf663de5a8af8fa9464aaf935ca2d.tar.bz2 manaverse-877bfe276efcf663de5a8af8fa9464aaf935ca2d.tar.xz manaverse-877bfe276efcf663de5a8af8fa9464aaf935ca2d.zip |
Simplify using rotational particle effect.
Diffstat (limited to 'src/effectmanager.cpp')
-rw-r--r-- | src/effectmanager.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index 1f5db8344..a6671870b 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -80,6 +80,30 @@ EffectManager::~EffectManager() { } +bool EffectManager::triggerDirection(const int id, Being *const being, + const SpriteDirection::Type &direction) +{ + int rotation; + switch (direction) + { + case SpriteDirection::DOWN: + default: + rotation = 0; + break; + case SpriteDirection::LEFT: + rotation = 90; + break; + case SpriteDirection::UP: + rotation = 180; + break; + case SpriteDirection::RIGHT: + rotation = 270; + break; + } + + return trigger(id, being, rotation); +} + bool EffectManager::trigger(const int id, Being *const being, const int rotation) { @@ -162,3 +186,14 @@ bool EffectManager::trigger(const int id, const int x, const int y, } return rValue; } + +void EffectManager::triggerDefault(int effectId, + Being *const being, + const int defaultEffectId) +{ + if (effectId == -1) + effectId = defaultEffectId; + if (effectId == -1) + return; + trigger(effectId, being); +} |