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.noosa.tweeners.Delayer;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.Callback;
|
import com.watabou.utils.Callback;
|
||||||
import com.watabou.utils.ColorMath;
|
|
||||||
import com.watabou.utils.GameMath;
|
import com.watabou.utils.GameMath;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
import com.watabou.utils.Point;
|
import com.watabou.utils.Point;
|
||||||
@@ -1214,7 +1213,7 @@ public class Hero extends Char {
|
|||||||
|
|
||||||
//1 hunger spent total
|
//1 hunger spent total
|
||||||
} else if (Dungeon.level.map[action.dst] == Terrain.MINE_BOULDER){
|
} 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 );
|
Sample.INSTANCE.play( Assets.Sounds.MINE, 0.6f );
|
||||||
Level.set( action.dst, Terrain.EMPTY_DECO );
|
Level.set( action.dst, Terrain.EMPTY_DECO );
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -55,7 +55,6 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
|||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.Callback;
|
import com.watabou.utils.Callback;
|
||||||
import com.watabou.utils.ColorMath;
|
|
||||||
import com.watabou.utils.GameMath;
|
import com.watabou.utils.GameMath;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
@@ -644,7 +643,7 @@ public class GnollGeomancer extends Mob {
|
|||||||
reset( from, rockPath.collisionPos, new GnollGeomancer.Boulder(), new Callback() {
|
reset( from, rockPath.collisionPos, new GnollGeomancer.Boulder(), new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void call() {
|
public void call() {
|
||||||
Splash.at(rockPath.collisionPos, ColorMath.random( 0x444444, 0x777766 ), 15);
|
Splash.at(rockPath.collisionPos, 0x555555, 15);
|
||||||
Sample.INSTANCE.play(Assets.Sounds.ROCKS);
|
Sample.INSTANCE.play(Assets.Sounds.ROCKS);
|
||||||
|
|
||||||
Char ch = Actor.findChar(rockPath.collisionPos);
|
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.PointF;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class Splash {
|
public class Splash {
|
||||||
|
|
||||||
public static void at( int cell, final int color, int n ) {
|
public static void at( int cell, final int color, int n ) {
|
||||||
@@ -45,10 +47,14 @@ public class Splash {
|
|||||||
if (emitter == null) return;
|
if (emitter == null) return;
|
||||||
emitter.pos( p );
|
emitter.pos( p );
|
||||||
|
|
||||||
FACTORY.color = color;
|
if (!FACTORIES.containsKey(color)){
|
||||||
FACTORY.dir = -3.1415926f / 2;
|
FACTORIES.put(color, new SplashFactory());
|
||||||
FACTORY.cone = 3.1415926f;
|
}
|
||||||
emitter.burst( FACTORY, n );
|
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 ) {
|
public static void at( PointF p, final float dir, final float cone, final int color, int n ) {
|
||||||
@@ -61,10 +67,13 @@ public class Splash {
|
|||||||
if (emitter == null) return;
|
if (emitter == null) return;
|
||||||
emitter.pos( p );
|
emitter.pos( p );
|
||||||
|
|
||||||
FACTORY.color = color;
|
if (!FACTORIES.containsKey(color)){
|
||||||
FACTORY.dir = dir;
|
FACTORIES.put(color, new SplashFactory());
|
||||||
FACTORY.cone = cone;
|
}
|
||||||
emitter.burst( FACTORY, n );
|
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 ) {
|
public static void around(Visual v, final int color, int n ) {
|
||||||
@@ -76,10 +85,14 @@ public class Splash {
|
|||||||
if (emitter == null) return;
|
if (emitter == null) return;
|
||||||
emitter.pos( v );
|
emitter.pos( v );
|
||||||
|
|
||||||
FACTORY.color = color;
|
if (!FACTORIES.containsKey(color)){
|
||||||
FACTORY.dir = -3.1415926f / 2;
|
FACTORIES.put(color, new SplashFactory());
|
||||||
FACTORY.cone = 3.1415926f;
|
}
|
||||||
emitter.burst( FACTORY, n );
|
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 ) {
|
public static void at( PointF p, final float dir, final float cone, final int color, int n, float interval ) {
|
||||||
@@ -92,13 +105,18 @@ public class Splash {
|
|||||||
if (emitter == null) return;
|
if (emitter == null) return;
|
||||||
emitter.pos( p );
|
emitter.pos( p );
|
||||||
|
|
||||||
FACTORY.color = color;
|
if (!FACTORIES.containsKey(color)){
|
||||||
FACTORY.dir = dir;
|
FACTORIES.put(color, new SplashFactory());
|
||||||
FACTORY.cone = cone;
|
}
|
||||||
emitter.start( FACTORY, interval, n );
|
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 {
|
private static class SplashFactory extends Emitter.Factory {
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GnollGeomancer;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EarthParticle;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EarthParticle;
|
||||||
import com.watabou.noosa.TextureFilm;
|
import com.watabou.noosa.TextureFilm;
|
||||||
import com.watabou.noosa.particles.Emitter;
|
import com.watabou.noosa.particles.Emitter;
|
||||||
import com.watabou.utils.ColorMath;
|
|
||||||
|
|
||||||
public class GnollGeomancerSprite extends MobSprite {
|
public class GnollGeomancerSprite extends MobSprite {
|
||||||
|
|
||||||
@@ -138,6 +137,6 @@ public class GnollGeomancerSprite extends MobSprite {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int blood() {
|
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