summaryrefslogtreecommitdiff
path: root/src/effectmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-08 20:40:13 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-08 23:17:42 +0300
commit877bfe276efcf663de5a8af8fa9464aaf935ca2d (patch)
treed00a91bae411640ca57b8cf7b8b2559a2fc4c36c /src/effectmanager.cpp
parent894af147511679d9db979b8169540c3e922ce375 (diff)
downloadplus-877bfe276efcf663de5a8af8fa9464aaf935ca2d.tar.gz
plus-877bfe276efcf663de5a8af8fa9464aaf935ca2d.tar.bz2
plus-877bfe276efcf663de5a8af8fa9464aaf935ca2d.tar.xz
plus-877bfe276efcf663de5a8af8fa9464aaf935ca2d.zip
Simplify using rotational particle effect.
Diffstat (limited to 'src/effectmanager.cpp')
-rw-r--r--src/effectmanager.cpp35
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);
+}