当前位置: 首页>>代码示例>>Java>>正文


Java Level.set方法代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.levels.Level.set方法的典型用法代码示例。如果您正苦于以下问题:Java Level.set方法的具体用法?Java Level.set怎么用?Java Level.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.shatteredpixel.shatteredpixeldungeon.levels.Level的用法示例。


在下文中一共展示了Level.set方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: affectCell

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void affectCell( int cell ) {
	
	Class<?>[] waters = {WaterOfHealth.class, WaterOfAwareness.class, WaterOfTransmutation.class};
	
	for (Class<?>waterClass : waters) {
		WellWater water = (WellWater)Dungeon.level.blobs.get( waterClass );
		if (water != null && 
			water.volume > 0 && 
			water.pos == cell && 
			water.affect()) {
			
			Level.set( cell, Terrain.EMPTY_WELL );
			GameScene.updateMap( cell );
			
			return;
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:WellWater.java

示例2: evolve

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected void evolve() {
	super.evolve();
	
	if (volume > 0) {
		
		boolean mapUpdated = false;
		
		for (int i=0; i < LENGTH; i++) {
			if (off[i] > 0) {
				int c = Dungeon.level.map[i];
				if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) {
					
					Level.set( i, cur[i] > 9 ? Terrain.HIGH_GRASS : Terrain.GRASS );
					mapUpdated = true;
					
				} else if (c == Terrain.GRASS && cur[i] > 9) {
					
					Level.set( i, Terrain.HIGH_GRASS );
					mapUpdated = true;
					
				}
				
				Char ch = Actor.findChar( i );
				if (ch != null) {
					Buff.prolong( ch, Roots.class, TICK );
				}
			}
		}
		
		if (mapUpdated) {
			GameScene.updateMap();
			Dungeon.observe();
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:37,代码来源:Regrowth.java

示例3: reallyDie

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void reallyDie( Object cause ) {
	
	int length = Level.LENGTH;
	int[] map = Dungeon.level.map;
	boolean[] visited = Dungeon.level.visited;
	boolean[] discoverable = Level.discoverable;
	
	for (int i=0; i < length; i++) {
		
		int terr = map[i];
		
		if (discoverable[i]) {
			
			visited[i] = true;
			if ((Terrain.flags[terr] & Terrain.SECRET) != 0) {
				Level.set( i, Terrain.discover( terr ) );						
				GameScene.updateMap( i );
			}
		}
	}
	
	Bones.leave();
	
	Dungeon.observe();
			
	Dungeon.hero.belongings.identify();
	
	GameScene.gameOver();
	
	if (cause instanceof Hero.Doom) {
		((Hero.Doom)cause).onDeath();
	}
	
	Dungeon.deleteGame( Dungeon.hero.heroClass, true );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:36,代码来源:Hero.java

示例4: onOperateComplete

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public void onOperateComplete() {
	
	if (curAction instanceof HeroAction.Unlock) {
		
		if (theKey != null) {
			theKey.detach( belongings.backpack );
			theKey = null;
		}
		
		int doorCell = ((HeroAction.Unlock)curAction).dst;
		int door = Dungeon.level.map[doorCell];
		
		Level.set( doorCell, door == Terrain.LOCKED_DOOR ? Terrain.DOOR : Terrain.UNLOCKED_EXIT );
		GameScene.updateMap( doorCell );
		
	} else if (curAction instanceof HeroAction.OpenChest) {
		
		if (theKey != null) {
			theKey.detach( belongings.backpack );
			theKey = null;
		}
		
		Heap heap = Dungeon.level.heaps.get( ((HeroAction.OpenChest)curAction).dst ); 
		if (heap.type == Type.SKELETON || heap.type == Type.REMAINS) {
			Sample.INSTANCE.play( Assets.SND_BONES );
		}
		heap.open( this );
	}
	curAction = null;

	super.onOperateComplete();
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:34,代码来源:Hero.java

示例5: jump

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
private void jump() {
	timeToJump = JUMP_DELAY;
	
	for (int i=0; i < 4; i++) {
		int trapPos;
		do {
			trapPos = Random.Int( Level.LENGTH );
		} while (!Level.fieldOfView[trapPos] || !Level.passable[trapPos]);
		
		if (Dungeon.level.map[trapPos] == Terrain.INACTIVE_TRAP) {
			Level.set( trapPos, Terrain.POISON_TRAP );
			GameScene.updateMap( trapPos );
			ScrollOfMagicMapping.discover( trapPos );
		}
	}
	
	int newPos;
	do {
		newPos = Random.Int( Level.LENGTH );
	} while (
		!Level.fieldOfView[newPos] || 
		!Level.passable[newPos] || 
		Level.adjacent( newPos, enemy.pos ) ||
		Actor.findChar( newPos ) != null);
	
	sprite.move( pos, newPos );
	move( newPos );
	
	if (Dungeon.visible[newPos]) {
		CellEmitter.get( newPos ).burst( Speck.factory( Speck.WOOL ), 6 );
		Sample.INSTANCE.play( Assets.SND_PUFF );
	}
	
	spend( 1 / speed() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:36,代码来源:Tengu.java

示例6: enter

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void enter( int pos ) {
	Level.set( pos, Terrain.OPEN_DOOR );
	GameScene.updateMap( pos );
	Dungeon.observe();
	
	if (Dungeon.visible[pos]) {
		Sample.INSTANCE.play( Assets.SND_OPEN );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:10,代码来源:Door.java

示例7: leave

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void leave( int pos ) {
	if (Dungeon.level.heaps.get( pos ) == null) {
		Level.set( pos, Terrain.DOOR );
		GameScene.updateMap( pos );
		Dungeon.observe();
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:8,代码来源:Door.java

示例8: evolve

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected void evolve() {

	boolean[] flamable = Level.flamable;
	
	int from = WIDTH + 1;
	int to = Level.LENGTH - WIDTH - 1;
	
	boolean observe = false;
	
	for (int pos=from; pos < to; pos++) {
		
		int fire;
		
		if (cur[pos] > 0) {
			
			burn( pos );
			
			fire = cur[pos] - 1;
			if (fire <= 0 && flamable[pos]) {
				
				int oldTile = Dungeon.level.map[pos];
				Level.set( pos, Terrain.EMBERS );
				
				observe = true;
				GameScene.updateMap( pos );
				if (Dungeon.visible[pos]) {
					GameScene.discoverTile( pos, oldTile );
				}
			}
			
		} else {
			
			if (flamable[pos] && (cur[pos-1] > 0 || cur[pos+1] > 0 || cur[pos-WIDTH] > 0 || cur[pos+WIDTH] > 0)) {
				fire = 4;
				burn( pos );
			} else {
				fire = 0;
			}

		}
		
		volume += (off[pos] = fire);

	}
	
	if (observe) {
		Dungeon.observe();
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:51,代码来源:Fire.java

示例9: move

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public void move( int step ) {
	super.move( step );
	
	if (Dungeon.level.map[step] == Terrain.INACTIVE_TRAP && HP < HT) {
		
		HP += Random.Int( 1, HT - HP );
		sprite.emitter().burst( ElmoParticle.FACTORY, 5 );
		
		if (Dungeon.visible[step] && Dungeon.hero.isAlive()) {
			GLog.n( "DM-300 repairs itself!" );
		}
	}
	
	int[] cells = {
		step-1, step+1, step-Level.WIDTH, step+Level.WIDTH, 
		step-1-Level.WIDTH, 
		step-1+Level.WIDTH, 
		step+1-Level.WIDTH, 
		step+1+Level.WIDTH
	};
	int cell = cells[Random.Int( cells.length )];
	
	if (Dungeon.visible[cell]) {
		CellEmitter.get( cell ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 );
		Camera.main.shake( 3, 0.7f );
		Sample.INSTANCE.play( Assets.SND_ROCKS );
		
		if (Level.water[cell]) {
			GameScene.ripple( cell );
		} else if (Dungeon.level.map[cell] == Terrain.EMPTY) {
			Level.set( cell, Terrain.EMPTY_DECO );
			GameScene.updateMap( cell );
		}
	}

	Char ch = Actor.findChar( cell );
	if (ch != null && ch != this) {
		Buff.prolong( ch, Paralysis.class, 2 );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:42,代码来源:DM300.java

示例10: doRead

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected void doRead() {
	
	int length = Level.LENGTH;
	int[] map = Dungeon.level.map;
	boolean[] mapped = Dungeon.level.mapped;
	boolean[] discoverable = Level.discoverable;
	
	boolean noticed = false;
	
	for (int i=0; i < length; i++) {
		
		int terr = map[i];
		
		if (discoverable[i]) {
			
			mapped[i] = true;
			if ((Terrain.flags[terr] & Terrain.SECRET) != 0) {
				
				Level.set( i, Terrain.discover( terr ) );						
				GameScene.updateMap( i );
				
				if (Dungeon.visible[i]) {
					GameScene.discoverTile( i, terr );
					discover( i );
					
					noticed = true;
				}
			}
		}
	}
	Dungeon.observe();
	
	GLog.i( TXT_LAYOUT );
	if (noticed) {
		Sample.INSTANCE.play( Assets.SND_SECRET );
	}
	
	SpellSprite.show( curUser, SpellSprite.MAP );
	Sample.INSTANCE.play( Assets.SND_READ );
	Invisibility.dispel();
	
	setKnown();
	
	curUser.spendAndNext( TIME_TO_READ );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:47,代码来源:ScrollOfMagicMapping.java

示例11: affectHero

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected boolean affectHero( Hero hero ) {
	
	Sample.INSTANCE.play( Assets.SND_DRINK );
	emitter.parent.add( new Identification( DungeonTilemap.tileCenterToWorld( pos ) ) );
	
	hero.belongings.observe();
	
	for (int i=0; i < Level.LENGTH; i++) {
		
		int terr = Dungeon.level.map[i];
		if ((Terrain.flags[terr] & Terrain.SECRET) != 0) {
			
			Level.set( i, Terrain.discover( terr ) );						
			GameScene.updateMap( i );
			
			if (Dungeon.visible[i]) {
				GameScene.discoverTile( i, terr );
			}
		}
	}
	
	Buff.affect( hero, Awareness.class, Awareness.DURATION );
	Dungeon.observe();

	Dungeon.hero.interrupt();

	GLog.p( TXT_PROCCED );
	
	Journal.remove( Feature.WELL_OF_AWARENESS );
	
	return true;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:34,代码来源:WaterOfAwareness.java


注:本文中的com.shatteredpixel.shatteredpixeldungeon.levels.Level.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。