v2.3.0: extended support for multiple splash effects at once
This commit is contained in:
@@ -159,7 +159,6 @@ import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.noosa.tweeners.Delayer;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Callback;
|
||||
import com.watabou.utils.ColorMath;
|
||||
import com.watabou.utils.GameMath;
|
||||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Point;
|
||||
@@ -1214,7 +1213,7 @@ public class Hero extends Char {
|
||||
|
||||
//1 hunger spent total
|
||||
} else if (Dungeon.level.map[action.dst] == Terrain.MINE_BOULDER){
|
||||
Splash.at(action.dst, ColorMath.random( 0x444444, 0x777766 ), 5);
|
||||
Splash.at(action.dst, 0x555555, 5);
|
||||
Sample.INSTANCE.play( Assets.Sounds.MINE, 0.6f );
|
||||
Level.set( action.dst, Terrain.EMPTY_DECO );
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Callback;
|
||||
import com.watabou.utils.ColorMath;
|
||||
import com.watabou.utils.GameMath;
|
||||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Random;
|
||||
@@ -644,7 +643,7 @@ public class GnollGeomancer extends Mob {
|
||||
reset( from, rockPath.collisionPos, new GnollGeomancer.Boulder(), new Callback() {
|
||||
@Override
|
||||
public void call() {
|
||||
Splash.at(rockPath.collisionPos, ColorMath.random( 0x444444, 0x777766 ), 15);
|
||||
Splash.at(rockPath.collisionPos, 0x555555, 15);
|
||||
Sample.INSTANCE.play(Assets.Sounds.ROCKS);
|
||||
|
||||
Char ch = Actor.findChar(rockPath.collisionPos);
|
||||
|
||||
@@ -29,6 +29,8 @@ import com.watabou.noosa.particles.PixelParticle;
|
||||
import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Splash {
|
||||
|
||||
public static void at( int cell, final int color, int n ) {
|
||||
@@ -44,11 +46,15 @@ public class Splash {
|
||||
Emitter emitter = GameScene.emitter();
|
||||
if (emitter == null) return;
|
||||
emitter.pos( p );
|
||||
|
||||
FACTORY.color = color;
|
||||
FACTORY.dir = -3.1415926f / 2;
|
||||
FACTORY.cone = 3.1415926f;
|
||||
emitter.burst( FACTORY, n );
|
||||
|
||||
if (!FACTORIES.containsKey(color)){
|
||||
FACTORIES.put(color, new SplashFactory());
|
||||
}
|
||||
SplashFactory fact = FACTORIES.get(color);
|
||||
fact.color = color;
|
||||
fact.dir = -3.1415926f / 2;
|
||||
fact.cone = 3.1415926f;
|
||||
emitter.burst( fact, n );
|
||||
}
|
||||
|
||||
public static void at( PointF p, final float dir, final float cone, final int color, int n ) {
|
||||
@@ -60,11 +66,14 @@ public class Splash {
|
||||
Emitter emitter = GameScene.emitter();
|
||||
if (emitter == null) return;
|
||||
emitter.pos( p );
|
||||
|
||||
FACTORY.color = color;
|
||||
FACTORY.dir = dir;
|
||||
FACTORY.cone = cone;
|
||||
emitter.burst( FACTORY, n );
|
||||
|
||||
if (!FACTORIES.containsKey(color)){
|
||||
FACTORIES.put(color, new SplashFactory());
|
||||
}
|
||||
SplashFactory fact = FACTORIES.get(color);fact.color = color;
|
||||
fact.dir = dir;
|
||||
fact.cone = cone;
|
||||
emitter.burst( fact, n );
|
||||
}
|
||||
|
||||
public static void around(Visual v, final int color, int n ) {
|
||||
@@ -76,10 +85,14 @@ public class Splash {
|
||||
if (emitter == null) return;
|
||||
emitter.pos( v );
|
||||
|
||||
FACTORY.color = color;
|
||||
FACTORY.dir = -3.1415926f / 2;
|
||||
FACTORY.cone = 3.1415926f;
|
||||
emitter.burst( FACTORY, n );
|
||||
if (!FACTORIES.containsKey(color)){
|
||||
FACTORIES.put(color, new SplashFactory());
|
||||
}
|
||||
SplashFactory fact = FACTORIES.get(color);
|
||||
fact.color = color;
|
||||
fact.dir = -3.1415926f / 2;
|
||||
fact.cone = 3.1415926f;
|
||||
emitter.burst( fact, n );
|
||||
}
|
||||
|
||||
public static void at( PointF p, final float dir, final float cone, final int color, int n, float interval ) {
|
||||
@@ -92,14 +105,19 @@ public class Splash {
|
||||
if (emitter == null) return;
|
||||
emitter.pos( p );
|
||||
|
||||
FACTORY.color = color;
|
||||
FACTORY.dir = dir;
|
||||
FACTORY.cone = cone;
|
||||
emitter.start( FACTORY, interval, n );
|
||||
if (!FACTORIES.containsKey(color)){
|
||||
FACTORIES.put(color, new SplashFactory());
|
||||
}
|
||||
SplashFactory fact = FACTORIES.get(color);
|
||||
fact.color = color;
|
||||
fact.dir = dir;
|
||||
fact.cone = cone;
|
||||
emitter.start( fact, interval, n );
|
||||
}
|
||||
|
||||
private static final SplashFactory FACTORY = new SplashFactory();
|
||||
|
||||
|
||||
//each color has its own factory, let's multiple splash effects occur at once
|
||||
private static final HashMap<Integer, SplashFactory> FACTORIES = new HashMap<>();
|
||||
|
||||
private static class SplashFactory extends Emitter.Factory {
|
||||
|
||||
public int color;
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GnollGeomancer;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EarthParticle;
|
||||
import com.watabou.noosa.TextureFilm;
|
||||
import com.watabou.noosa.particles.Emitter;
|
||||
import com.watabou.utils.ColorMath;
|
||||
|
||||
public class GnollGeomancerSprite extends MobSprite {
|
||||
|
||||
@@ -138,6 +137,6 @@ public class GnollGeomancerSprite extends MobSprite {
|
||||
|
||||
@Override
|
||||
public int blood() {
|
||||
return curAnim == statue ? ColorMath.random( 0x444444, 0x777766 ) : super.blood();
|
||||
return curAnim == statue ? 0x555555 : super.blood();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user