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


Java Actor.occupyCell方法代码示例

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


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

示例1: spawn

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static void spawn( CityLevel level ) {
	if (!spawned && Dungeon.depth > 16 && Random.Int( 20 - Dungeon.depth ) == 0) {
		
		Imp npc = new Imp();
		do {
			npc.pos = level.randomRespawnCell();
		} while (npc.pos == -1 || level.heaps.get( npc.pos ) != null);
		level.mobs.add( npc );
		Actor.occupyCell( npc );
		
		spawned = true;	
		alternative = Random.Int( 2 ) == 0;
		
		given = false;
		
		do {
			reward = (Ring)Generator.random( Generator.Category.RING );
		} while (reward.cursed);
		reward.upgrade( 2 );
		reward.cursed = true;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:Imp.java

示例2: createMobs

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
protected void createMobs() {
	int nMobs = nMobs();
	for (int i=0; i < nMobs; i++) {
		Mob mob = Bestiary.mob( Dungeon.depth );
		do {
			mob.pos = randomRespawnCell();
		} while (mob.pos == -1);
		mobs.add( mob );
		Actor.occupyCell( mob );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:13,代码来源:RegularLevel.java

示例3: paint

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.FIRE_TRAP );
		fill( level, room, 2, Terrain.EMPTY_SP );
		
		for (int i=0; i < 2; i++) {
			int pos;
			do {
				pos = room.random();
			} while (level.map[pos] != Terrain.EMPTY_SP);
			level.drop( 
				Generator.random( Random.oneOf( 
					Generator.Category.ARMOR, 
					Generator.Category.WEAPON
				) ), pos );
		}
		
		for (Room.Door door : room.connected.values()) {
			door.set( Room.Door.Type.UNLOCKED );
			drawInside( level, room, door, 1, Terrain.EMPTY );
		}
		
		Blacksmith npc = new Blacksmith();
		do {
			npc.pos = room.random( 1 );
		} while (level.heaps.get( npc.pos ) != null);
		level.mobs.add( npc );
		Actor.occupyCell( npc );
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:31,代码来源:BlacksmithPainter.java

示例4: add

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static void add( Mob mob ) {
	Dungeon.level.mobs.add( mob );
	Actor.add( mob );
	Actor.occupyCell( mob );
	scene.addMobSprite( mob );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:7,代码来源:GameScene.java

示例5: trigger

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static void trigger( int pos, Char c ) {
	
	if (Dungeon.bossLevel()) {
		return;
	}
	
	if (c != null) {
		Actor.occupyCell( c );
	}
	
	int nMobs = 1;
	if (Random.Int( 2 ) == 0) {
		nMobs++;
		if (Random.Int( 2 ) == 0) {
			nMobs++;
		}
	}
	
	// It's complicated here, because these traps can be activated in chain
	
	ArrayList<Integer> candidates = new ArrayList<Integer>();
	
	for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
		int p = pos + Level.NEIGHBOURS8[i];
		if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
			candidates.add( p );
		}
	}
	
	ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
	
	while (nMobs > 0 && candidates.size() > 0) {
		int index = Random.index( candidates );
		
		DUMMY.pos = candidates.get( index );
		Actor.occupyCell( DUMMY );
		
		respawnPoints.add( candidates.remove( index ) );
		nMobs--;
	}
	
	for (Integer point : respawnPoints) {
		Mob mob = Bestiary.mob( Dungeon.depth );
		mob.state = mob.WANDERING;
		GameScene.add( mob, DELAY );
		WandOfBlink.appear( mob, point );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:49,代码来源:SummoningTrap.java

示例6: paint

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {
	
	fill( level, room, Terrain.WALL );
	fill( level, room, 1, Terrain.WATER );
	
	Room.Door door = room.entrance(); 
	door.set( Room.Door.Type.REGULAR );

	int x = -1;
	int y = -1;
	if (door.x == room.left) {
		
		x = room.right - 1;
		y = room.top + room.height() / 2;
		
	} else if (door.x == room.right) {
		
		x = room.left + 1;
		y = room.top + room.height() / 2;
		
	} else if (door.y == room.top) {
		
		x = room.left + room.width() / 2;
		y = room.bottom - 1;
		
	} else if (door.y == room.bottom) {
		
		x = room.left + room.width() / 2;
		y = room.top + 1;
		
	}
	
	int pos = x + y * Level.WIDTH;
	level.drop( prize( level ), pos ).type = 
		Random.Int( 3 ) == 0 ? Heap.Type.CHEST : Heap.Type.HEAP;
	set( level, pos, Terrain.PEDESTAL );
	
	level.addItemToSpawn( new PotionOfInvisibility() );
	
	for (int i=0; i < NPIRANHAS; i++) {
		Piranha piranha = new Piranha();
		do {
			piranha.pos = room.random();
		} while (level.map[piranha.pos] != Terrain.WATER|| Actor.findChar( piranha.pos ) != null);
		level.mobs.add( piranha );
		Actor.occupyCell( piranha );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:49,代码来源:PoolPainter.java

示例7: paint

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY );

		Point c = room.center();
		int cx = c.x;
		int cy = c.y;
		
		Room.Door door = room.entrance();
		
		door.set( Room.Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey( Dungeon.depth ) );
		
		if (door.x == room.left) {
			
			fill( level, room.right - 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
			cx = room.right - 2;
			
		} else if (door.x == room.right) {
			
			fill( level, room.left + 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
			cx = room.left + 2;
			
		} else if (door.y == room.top) {
			
			fill( level, room.left + 1, room.bottom - 1, room.width() - 1, 1 , Terrain.STATUE );
			cy = room.bottom - 2;
			
		} else if (door.y == room.bottom) {
			
			fill( level, room.left + 1, room.top + 1, room.width() - 1, 1 , Terrain.STATUE );
			cy = room.top + 2;
			
		}
		
		Statue statue = new Statue();
		statue.pos = cx + cy * Level.WIDTH;
		level.mobs.add( statue );
		Actor.occupyCell( statue );
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:42,代码来源:StatuePainter.java


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