• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java GoldenKey类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.watabou.pixeldungeon.items.keys.GoldenKey的典型用法代码示例。如果您正苦于以下问题:Java GoldenKey类的具体用法?Java GoldenKey怎么用?Java GoldenKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

GoldenKey类属于com.watabou.pixeldungeon.items.keys包,在下文中一共展示了GoldenKey类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: paint

点赞 2

import com.watabou.pixeldungeon.items.keys.GoldenKey; //导入依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY_SP );
		fill( level, room, 2, Terrain.EMPTY );
		
		int cx = (room.left + room.right) / 2;
		int cy = (room.top + room.bottom) / 2;
		int c = cx + cy * Level.WIDTH;
		
		switch (Random.Int( 3 )) {
		
		case 0:
			level.drop( prize( level ), c ).type = Type.LOCKED_CHEST;
			level.addItemToSpawn( new GoldenKey() );
			break;
			
		case 1:
			Item i1, i2;
			do {
				i1 = prize( level );
				i2 = prize( level );
			} while (i1.getClass() == i2.getClass());
			level.drop( i1, c ).type = Type.CRYSTAL_CHEST;
			level.drop( i2, c + Level.NEIGHBOURS8[Random.Int( 8 )]).type = Type.CRYSTAL_CHEST;
			level.addItemToSpawn( new GoldenKey() );
			break;
			
		case 2:
			level.drop( prize( level ), c );
			set( level, c, Terrain.PEDESTAL );
			break;
		}
		
		room.entrance().set( Room.Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey() );
	}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:38,
代码来源:VaultPainter.java

示例2: paint

点赞 2

import com.watabou.pixeldungeon.items.keys.GoldenKey; //导入依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY );
		
		int cx = (room.left + room.right) / 2;
		int cy = (room.top + room.bottom) / 2;
		int c = cx + cy * Level.WIDTH;
		
		switch (Random.Int( 3 )) {
		
		case 0:
			level.drop( prize( level ), c ).type = Type.LOCKED_CHEST;
			level.addItemToSpawn( new GoldenKey() );
			break;
			
		case 1:
			Item i1, i2;
			do {
				i1 = prize( level );
				i2 = prize( level );
			} while (i1.getClass() == i2.getClass());
			level.drop( i1, c ).type = Type.CRYSTAL_CHEST;
			level.drop( i2, c + Level.NEIGHBOURS8[Random.Int( 8 )]).type = Type.CRYSTAL_CHEST;
			level.addItemToSpawn( new GoldenKey() );
			break;
			
		case 2:
			level.drop( prize( level ), c );
			set( level, c, Terrain.PEDESTAL );
			break;
		}
		
		room.entrance().set( Room.Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey() );
	}
 

开发者ID:skynet67,
项目名称:pixel-dungeon-rebirth,
代码行数:37,
代码来源:VaultPainter.java

示例3: paint

点赞 2

import com.watabou.pixeldungeon.items.keys.GoldenKey; //导入依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY );
		
		int cx = (room.left + room.right) / 2;
		int cy = (room.top + room.bottom) / 2;
		int c = cx + cy * level.getWidth();
		
		switch (Random.Int( 3 )) {
		
		case 0:
			level.drop( prize( level ), c ).type = Type.LOCKED_CHEST;
			level.addItemToSpawn( new GoldenKey() );
			break;
			
		case 1:
			Item i1, i2;
			do {
				i1 = prize( level );
				i2 = prize( level );
			} while (i1.getClass() == i2.getClass());
			level.drop( i1, c ).type = Type.CRYSTAL_CHEST;
			level.drop( i2, c + Level.NEIGHBOURS8[Random.Int( 8 )]).type = Type.CRYSTAL_CHEST;
			level.addItemToSpawn( new GoldenKey() );
			break;
			
		case 2:
			level.drop( prize( level ), c );
			set( level, c, Terrain.PEDESTAL );
			break;
		}
		
		room.entrance().set( Room.Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey() );
	}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:37,
代码来源:VaultPainter.java

示例4: actOpenChest

点赞 2

import com.watabou.pixeldungeon.items.keys.GoldenKey; //导入依赖的package包/类
private boolean actOpenChest( HeroAction.OpenChest action ) {
	int dst = action.dst;
	if (Level.adjacent( pos, dst ) || pos == dst) {
		
		Heap heap = Dungeon.level.heaps.get( dst );
		if (heap != null && (heap.type != Type.HEAP && heap.type != Type.FOR_SALE)) {
			
			theKey = null;
			
			if (heap.type == Type.LOCKED_CHEST || heap.type == Type.CRYSTAL_CHEST) {

				theKey = belongings.getKey( GoldenKey.class, Dungeon.depth );
				
				if (theKey == null) {
					GLog.w( TXT_LOCKED_CHEST );
					ready();
					return false;
				}
			}
			
			switch (heap.type) {
			case TOMB:
				Sample.INSTANCE.play( Assets.SND_TOMB );
				Camera.main.shake( 1, 0.5f );
				break;
			case SKELETON:
				break;
			default:
				Sample.INSTANCE.play( Assets.SND_UNLOCK );
			}
			
			spend( Key.TIME_TO_UNLOCK );
			sprite.operate( dst );
			
		} else {
			ready();
		}
		
		return false;
		
	} else if (getCloser( dst )) {
		
		return true;
		
	} else {
		ready();
		return false;
	}
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:50,
代码来源:Hero.java

示例5: actOpenChest

点赞 2

import com.watabou.pixeldungeon.items.keys.GoldenKey; //导入依赖的package包/类
private boolean actOpenChest(HeroAction.OpenChest action) {
	int dst = action.dst;
	if (Dungeon.level.adjacent(getPos(), dst) || getPos() == dst) {

		Heap heap = Dungeon.level.getHeap(dst);
		if (heap != null && (heap.type == Type.CHEST || heap.type == Type.TOMB || heap.type == Type.SKELETON
				|| heap.type == Type.LOCKED_CHEST || heap.type == Type.CRYSTAL_CHEST || heap.type == Type.MIMIC)) {

			theKey = null;

			if (heap.type == Type.LOCKED_CHEST || heap.type == Type.CRYSTAL_CHEST) {

				theKey = belongings.getKey(GoldenKey.class, Dungeon.depth, Dungeon.level.levelId);

				if (theKey == null) {
					GLog.w(TXT_LOCKED_CHEST);
					ready();
					return false;
				}
			}

			switch (heap.type) {
				case TOMB:
					Sample.INSTANCE.play(Assets.SND_TOMB);
					Camera.main.shake(1, 0.5f);
					break;
				case SKELETON:
					break;
				default:
					Sample.INSTANCE.play(Assets.SND_UNLOCK);
			}

			spend(Key.TIME_TO_UNLOCK);
			getSprite().operate(dst);

		} else {
			ready();
		}

		return false;

	} else if (getCloser(dst)) {

		return true;

	} else {
		ready();
		return false;
	}
}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:51,
代码来源:Hero.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)