本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.Dungeon.visible方法的典型用法代码示例。如果您正苦于以下问题:Java Dungeon.visible方法的具体用法?Java Dungeon.visible怎么用?Java Dungeon.visible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shatteredpixel.shatteredpixeldungeon.Dungeon
的用法示例。
在下文中一共展示了Dungeon.visible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public void update() {
super.update();
visible = pos == -1 || Dungeon.visible[pos];
switch (state) {
case GROWING:
if ((time -= Game.elapsed) <= 0) {
state = State.NORMAL;
scale.set( 1 );
} else {
scale.set( 1 - time / DELAY );
}
break;
case WITHERING:
if ((time -= Game.elapsed) <= 0) {
super.kill();
} else {
alpha( time / DELAY );
}
break;
default:
}
}
示例2: act
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
protected boolean act() {
if (!Quest.given && Dungeon.visible[pos]) {
if (!seenBefore) {
yell( Utils.format( TXT_HEY, Dungeon.hero.givenName() ) );
}
seenBefore = true;
} else {
seenBefore = false;
}
throwItem();
return super.act();
}
示例3: activate
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public void activate( Char ch ) {
super.activate( ch );
if (ch != null) {
int len = Random.Int( 5, 10 );
Buff.prolong( ch, Blindness.class, len );
Buff.prolong( ch, Cripple.class, len );
if (ch instanceof Mob) {
((Mob)ch).state = ((Mob)ch).WANDERING;
((Mob)ch).beckon( Dungeon.level.randomDestination() );
}
}
if (Dungeon.visible[pos]) {
CellEmitter.get( pos ).burst( Speck.factory( Speck.LIGHT ), 4 );
}
}
示例4: die
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public void die( Object cause ) {
super.die( cause );
boolean heroKilled = false;
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
Char ch = findChar( pos + Level.NEIGHBOURS8[i] );
if (ch != null && ch.isAlive()) {
int damage = Math.max( 0, damageRoll() - Random.IntRange( 0, ch.dr() / 2 ) );
ch.damage( damage, this );
if (ch == Dungeon.hero && !ch.isAlive()) {
heroKilled = true;
}
}
}
if (Dungeon.visible[pos]) {
Sample.INSTANCE.play( Assets.SND_BONES );
}
if (heroKilled) {
Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) );
GLog.n( TXT_HERO_KILLED );
}
}
示例5: affect
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
public static void affect( int cell, Fire fire ) {
Char ch = Actor.findChar( cell );
if (ch != null) {
if (Level.water[ch.pos]){
Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(5f, 7.5f));
} else {
Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(1.0f, 1.5f));
}
}
if (fire != null) {
fire.clear( cell );
}
Heap heap = Dungeon.level.heaps.get( cell );
if (heap != null) {
heap.freeze();
}
if (Dungeon.visible[cell]) {
CellEmitter.get( cell ).start( SnowParticle.FACTORY, 0.2f, 6 );
}
}
示例6: press
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public void press( int cell, Char hero ) {
super.press( cell, hero );
if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) {
enteredArena = true;
locked = true;
Mob boss = Bestiary.mob( Dungeon.depth );
boss.state = boss.HUNTING;
do {
boss.pos = Random.Int( LENGTH );
} while (
!passable[boss.pos] ||
!outsideEntraceRoom( boss.pos ) ||
Dungeon.visible[boss.pos]);
GameScene.add( boss );
set( arenaDoor, Terrain.LOCKED_DOOR );
GameScene.updateMap( arenaDoor );
Dungeon.observe();
}
}
示例7: randomRespawnCell
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public int randomRespawnCell() {
int count = 0;
int cell = -1;
while (true) {
if (++count > 30) {
return -1;
}
Room room = randomRoom( Room.Type.STANDARD, 10 );
if (room == null) {
continue;
}
cell = room.random();
if (!Dungeon.visible[cell] && Actor.findChar( cell ) == null && Level.passable[cell]) {
return cell;
}
}
}
示例8: doAttack
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
protected boolean doAttack( Char enemy ) {
spend( attackDelay() );
boolean rayVisible = false;
for (int i=0; i < Ballistica.distance; i++) {
if (Dungeon.visible[Ballistica.trace[i]]) {
rayVisible = true;
}
}
if (rayVisible) {
sprite.attack( hitCell );
return false;
} else {
attack( enemy );
return true;
}
}
示例9: onComplete
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public void onComplete( Animation anim ) {
super.onComplete( anim );
if (anim == attack) {
if (Dungeon.visible[ch.pos] || Dungeon.visible[attackPos]) {
parent.add( new DeathRay( center(), DungeonTilemap.tileCenterToWorld( attackPos ) ) );
}
}
}
示例10: die
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public void die() {
super.die();
if (Dungeon.visible[ch.pos]) {
emitter().burst( Speck.factory( Speck.BONE ), 3 );
}
}
示例11: evolve
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
protected void evolve() {
volume = off[pos] = cur[pos];
if (Dungeon.visible[pos]) {
Journal.add( Journal.Feature.ALCHEMY );
}
}
示例12: activate
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public void activate( Char ch ) {
super.activate( ch );
if (ch != null) {
Buff.affect( ch, Armor.class ).level = ch.HT;
}
if (Dungeon.visible[pos]) {
CellEmitter.bottom( pos ).start( EarthParticle.FACTORY, 0.05f, 8 );
Camera.main.shake( 1, 0.4f );
}
}
示例13: activate
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public void activate( Char ch ) {
super.activate( ch );
if (ch != null) {
Buff.affect( ch, Poison.class ).set( Poison.durationFactor( ch ) * (4 + Dungeon.depth / 2) );
}
if (Dungeon.visible[pos]) {
CellEmitter.center( pos ).burst( PoisonParticle.SPLASH, 3 );
}
}
示例14: activate
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public void activate( Char ch ) {
super.activate( ch );
if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero( (Hero)ch );
((Hero)ch).curAction = null;
} else if (ch instanceof Mob) {
// Why do I try to choose a new position 10 times?
// I don't remember...
int count = 10;
int newPos;
do {
newPos = Dungeon.level.randomRespawnCell();
if (count-- <= 0) {
break;
}
} while (newPos == -1);
if (newPos != -1) {
ch.pos = newPos;
ch.sprite.place( ch.pos );
ch.sprite.visible = Dungeon.visible[pos];
}
}
if (Dungeon.visible[pos]) {
CellEmitter.get( pos ).start( Speck.factory( Speck.LIGHT ), 0.2f, 3 );
}
}
示例15: press
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入方法依赖的package包/类
@Override
public void press( int cell, Char hero ) {
super.press( cell, hero );
if (!enteredArena && hero == Dungeon.hero && cell != entrance) {
enteredArena = true;
locked = true;
for (int i=ROOM_LEFT-1; i <= ROOM_RIGHT + 1; i++) {
doMagic( (ROOM_TOP - 1) * WIDTH + i );
doMagic( (ROOM_BOTTOM + 1) * WIDTH + i );
}
for (int i=ROOM_TOP; i < ROOM_BOTTOM + 1; i++) {
doMagic( i * WIDTH + ROOM_LEFT - 1 );
doMagic( i * WIDTH + ROOM_RIGHT + 1 );
}
doMagic( entrance );
GameScene.updateMap();
Dungeon.observe();
Yog boss = new Yog();
do {
boss.pos = Random.Int( LENGTH );
} while (
!passable[boss.pos] ||
Dungeon.visible[boss.pos]);
GameScene.add( boss );
boss.spawnFists();
stairs = entrance;
entrance = -1;
}
}