本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.actors.Actor.add方法的典型用法代码示例。如果您正苦于以下问题:Java Actor.add方法的具体用法?Java Actor.add怎么用?Java Actor.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shatteredpixel.shatteredpixeldungeon.actors.Actor
的用法示例。
在下文中一共展示了Actor.add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shatter
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
protected void shatter( int cell ) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
ToxicGas gas = Blob.seed( cell, 1000, ToxicGas.class );
Actor.add( gas );
GameScene.add( gas );
}
示例2: switchLevel
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void switchLevel( final Level level, int pos ) {
if (pos < 0 || pos >= level.length()){
pos = level.exit;
}
PathFinder.setMapSize(level.width(), level.height());
Dungeon.level = level;
DriedRose.restoreGhostHero( level, pos );
Actor.init();
Actor respawner = level.respawner();
if (respawner != null) {
Actor.add( level.respawner() );
}
hero.pos = pos;
Light light = hero.buff( Light.class );
hero.viewDistance = light == null ? level.viewDistance : Math.max( Light.DISTANCE, level.viewDistance );
hero.curAction = hero.lastAction = null;
observe();
try {
saveAll();
} catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
/*This only catches IO errors. Yes, this means things can go wrong, and they can go wrong catastrophically.
But when they do the user will get a nice 'report this issue' dialogue, and I can fix the bug.*/
}
}
示例3: activate
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
public void activate() {
//use an actor as we want to put this on a slight delay so all chars get a chance to act this turn first.
Actor.add(new Actor() {
{ actPriority = 3; }
protected boolean act() {
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
if (Dungeon.level.insideMap(i)
&& Actor.findChar(i) == null
&& !(Dungeon.level.pit[i])) {
Sheep sheep = new Sheep();
sheep.lifespan = Random.NormalIntRange(3 + Dungeon.depth/4, 6 + Dungeon.depth/2 );
sheep.pos = i;
Dungeon.level.mobPress(sheep);
GameScene.add(sheep);
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
}
}
}
Sample.INSTANCE.play(Assets.SND_PUFF);
Actor.remove(this);
return true;
}
});
}
示例4: add
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static void add( Blob gas ) {
Actor.add( gas );
if (scene != null) {
scene.addBlobSprite( gas );
}
}
示例5: switchLevel
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void switchLevel( final Level level, int pos ) {
Dungeon.level = level;
Actor.init();
Actor respawner = level.respawner();
if (respawner != null) {
Actor.add( level.respawner() );
}
for (Potion potion : level.fallingPotions){
int cell = level.randomRespawnCell();
while (cell == -1)
cell = level.randomRespawnCell();
if (potion instanceof PotionOfLiquidFlame)
GameScene.add( Blob.seed( cell, 2, Fire.class));
else if (potion instanceof PotionOfToxicGas)
GameScene.add( Blob.seed( cell, 1000, ToxicGas.class ) );
else if (potion instanceof PotionOfParalyticGas)
GameScene.add( Blob.seed( cell, 1000, ParalyticGas.class ) );
else if (potion instanceof PotionOfLevitation)
GameScene.add( Blob.seed( cell, 1000, ConfusionGas.class ) );
}
level.fallingPotions.clear();
hero.pos = pos != -1 ? pos : level.exit;
Light light = hero.buff( Light.class );
hero.viewDistance = light == null ? level.viewDistance : Math.max( Light.DISTANCE, level.viewDistance );
observe();
try {
saveAll();
} catch (IOException e) {
/*This only catches IO errors. Yes, this means things can do wrong, and they can go wrong catastrophically.
But when they do the user will get a nice 'report this issue' dialogue, and I can fix the bug.*/
}
}
示例6: activate
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
public void activate() {
Char target = Actor.findChar(pos);
//find the closest char that can be aimed at
if (target == null){
for (Char ch : Actor.chars()){
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos &&
(target == null || Dungeon.level.distNoDiag(pos, ch.pos) < Dungeon.level.distNoDiag(pos, target.pos))){
target = ch;
}
}
}
if (target != null) {
final Char finalTarget = target;
final PoisonDartTrap trap = this;
if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[target.pos]) {
Actor.add(new Actor() {
{
//it's a visual effect, gets priority no matter what
actPriority = Integer.MIN_VALUE;
}
@Override
protected boolean act() {
final Actor toRemove = this;
((MissileSprite) ShatteredPixelDungeon.scene().recycle(MissileSprite.class)).
reset(pos, finalTarget.sprite, new Dart(), new Callback() {
@Override
public void call() {
int dmg = Random.NormalIntRange(1, 4) - finalTarget.drRoll();
finalTarget.damage(dmg, trap);
if (finalTarget == Dungeon.hero && !finalTarget.isAlive()){
Dungeon.fail( trap.getClass() );
}
Buff.affect( finalTarget, Poison.class )
.set( Poison.durationFactor( finalTarget ) * (4 + Dungeon.depth) );
Sample.INSTANCE.play(Assets.SND_HIT, 1, 1, Random.Float(0.8f, 1.25f));
finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg);
finalTarget.sprite.flash();
Actor.remove(toRemove);
next();
}
});
return false;
}
});
} else {
finalTarget.damage(Random.NormalIntRange(1, 4) - finalTarget.drRoll(), trap);
Buff.affect( finalTarget, Poison.class )
.set( Poison.durationFactor( finalTarget ) * (4 + Dungeon.depth) );
}
}
}
示例7: activate
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
public void activate() {
Char target = Actor.findChar(pos);
//find the closest char that can be aimed at
if (target == null){
for (Char ch : Actor.chars()){
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos &&
(target == null || Dungeon.level.distNoDiag(pos, ch.pos) < Dungeon.level.distNoDiag(pos, target.pos))){
target = ch;
}
}
}
if (target != null) {
final Char finalTarget = target;
final WornDartTrap trap = this;
if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[target.pos]) {
Actor.add(new Actor() {
{
//it's a visual effect, gets priority no matter what
actPriority = Integer.MIN_VALUE;
}
@Override
protected boolean act() {
final Actor toRemove = this;
((MissileSprite) ShatteredPixelDungeon.scene().recycle(MissileSprite.class)).
reset(pos, finalTarget.sprite, new Dart(), new Callback() {
@Override
public void call() {
int dmg = Random.NormalIntRange(1, 4) - finalTarget.drRoll();
finalTarget.damage(dmg, trap);
if (finalTarget == Dungeon.hero && !finalTarget.isAlive()){
Dungeon.fail( trap.getClass() );
}
Sample.INSTANCE.play(Assets.SND_HIT, 1, 1, Random.Float(0.8f, 1.25f));
finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg);
finalTarget.sprite.flash();
Actor.remove(toRemove);
next();
}
});
return false;
}
});
} else {
finalTarget.damage(Random.NormalIntRange(1, 4) - finalTarget.drRoll(), trap);
}
}
}
示例8: activate
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
public void activate() {
Char target = Actor.findChar(pos);
//find the closest char that can be aimed at
if (target == null){
for (Char ch : Actor.chars()){
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos &&
(target == null || Dungeon.level.distNoDiag(pos, ch.pos) < Dungeon.level.distNoDiag(pos, target.pos))){
target = ch;
}
}
}
if (target != null){
final Char finalTarget = target;
final GrimTrap trap = this;
int damage;
//almost kill the player
if (finalTarget == Dungeon.hero && ((float)finalTarget.HP/finalTarget.HT) >= 0.9f){
damage = finalTarget.HP-1;
//kill 'em
} else {
damage = finalTarget.HP;
}
final int finalDmg = damage;
Actor.add(new Actor() {
{
//it's a visual effect, gets priority no matter what
actPriority = Integer.MIN_VALUE;
}
@Override
protected boolean act() {
final Actor toRemove = this;
((MagicMissile)finalTarget.sprite.parent.recycle(MagicMissile.class)).reset(
MagicMissile.SHADOW,
DungeonTilemap.tileCenterToWorld(pos),
finalTarget.sprite.center(),
new Callback() {
@Override
public void call() {
finalTarget.damage(finalDmg, trap);
if (finalTarget == Dungeon.hero) {
Sample.INSTANCE.play(Assets.SND_CURSED);
if (!finalTarget.isAlive()) {
Dungeon.fail( GrimTrap.class );
GLog.n( Messages.get(GrimTrap.class, "ondeath") );
}
} else {
Sample.INSTANCE.play(Assets.SND_BURNING);
}
finalTarget.sprite.emitter().burst(ShadowParticle.UP, 10);
Actor.remove(toRemove);
next();
}
});
return false;
}
});
} else {
CellEmitter.get(pos).burst(ShadowParticle.UP, 10);
Sample.INSTANCE.play(Assets.SND_BURNING);
}
}
示例9: restoreFromBundle
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
if (bundle.contains( FUSE ))
Actor.add( fuse = ((Fuse)bundle.get(FUSE)).ignite(this) );
}