本文整理汇总了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;
}
}
示例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 );
}
}
示例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 );
}
示例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 );
}
示例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 );
}
}
示例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 );
}
}
示例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 );
}