v0.3.0: added support for callbacks in pushing, used in ethereal chains

This commit is contained in:
Evan Debenham
2015-05-25 20:37:16 -04:00
parent f16865aade
commit 7aab6a8452
2 changed files with 18 additions and 5 deletions
@@ -22,6 +22,7 @@ import com.watabou.noosa.Visual;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.watabou.utils.Callback;
import com.watabou.utils.PointF;
public class Pushing extends Actor {
@@ -32,6 +33,8 @@ public class Pushing extends Actor {
private Effect effect;
private Callback callback;
{
actPriority = Integer.MIN_VALUE; //it's a visual effect, gets priority no matter what
}
@@ -40,6 +43,12 @@ public class Pushing extends Actor {
sprite = ch.sprite;
this.from = from;
this.to = to;
this.callback = null;
}
public Pushing( Char ch, int from, int to, Callback callback ) {
this(ch, from, to);
this.callback = callback;
}
@Override
@@ -96,10 +105,11 @@ public class Pushing extends Actor {
} else {
sprite.point( end );
sprite.point(end);
killAndErase();
Actor.remove( Pushing.this );
Actor.remove(Pushing.this);
if (callback != null) callback.call();
next();
}