本文整理汇总了Java中com.watabou.pixeldungeon.levels.Terrain.LOCKED_EXIT属性的典型用法代码示例。如果您正苦于以下问题:Java Terrain.LOCKED_EXIT属性的具体用法?Java Terrain.LOCKED_EXIT怎么用?Java Terrain.LOCKED_EXIT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.watabou.pixeldungeon.levels.Terrain
的用法示例。
在下文中一共展示了Terrain.LOCKED_EXIT属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
@Override
protected boolean build() {
Arrays.fill(map, Terrain.WALL);
createChambers();
Chamber ent = chambers.get(0);
entrance = cell(ent.x, ent.y);
map[entrance] = Terrain.ENTRANCE;
Chamber ext = chambers.get(chambers.size() - 1);
setExit(cell(ext.x, ext.y), 0);
if (Dungeon.depth != 10){
map[getExit(0)] = Terrain.EXIT;
} else{
map[getExit(0)] = Terrain.LOCKED_EXIT;
}
setFeeling(Feeling.NONE);
placeTraps();
return true;
}
示例2: build
@Override
protected boolean build() {
Painter.fill( this, _Left(), TOP, HALL_WIDTH, HALL_HEIGHT, Terrain.EMPTY_SP );
Painter.fill( this, _Left(), TOP, HALL_WIDTH, TOP, Terrain.EMPTY );
Painter.fill( this, _Left(), HALL_HEIGHT, HALL_WIDTH, TOP, Terrain.EMPTY );
for (int i = 0; i < 10; i++) {
map[getRandomTerrainCell(Terrain.EMPTY_SP)] = Terrain.STATUE_SP;
}
arenaDoor = (TOP + HALL_HEIGHT) * getWidth() + _Center();
map[arenaDoor] = Terrain.DOOR;
Painter.fill( this, _Left(), TOP + HALL_HEIGHT + 1, HALL_WIDTH, CHAMBER_HEIGHT, Terrain.EMPTY );
entrance = (TOP + HALL_HEIGHT + 2 + Random.Int( CHAMBER_HEIGHT - 1 )) * getWidth() + _Left() + (/*1 +*/ Random.Int( HALL_WIDTH-2 ));
map[entrance] = Terrain.ENTRANCE;
setExit((TOP - 1) * getWidth() + _Center(),0);
map[getExit(0)] = Terrain.LOCKED_EXIT;
return true;
}
示例3: tileName
@Override
public String tileName( int tile ) {
switch (tile) {
case Terrain.GRASS:
return Game.getVar(R.string.IceCaves_TileGrass);
case Terrain.HIGH_GRASS:
return Game.getVar(R.string.IceCaves_TileHighGrass);
case Terrain.WATER:
return Game.getVar(R.string.Caves_TileWater);
case Terrain.STATUE:
case Terrain.STATUE_SP:
return Game.getVar(R.string.IceCaves_TileStatue);
case Terrain.UNLOCKED_EXIT:
case Terrain.LOCKED_EXIT:
return Game.getVar(R.string.PortalGate_Name);
default:
return super.tileName( tile );
}
}
示例4: build
@Override
protected boolean build() {
Arrays.fill( map, Terrain.WALL );
Painter.fill( this, 2, 2, SIZE-2, SIZE-2, Terrain.WATER );
Painter.fill( this, 3, 3, SIZE-4, SIZE-4, Terrain.EMPTY );
Painter.fill( this, SIZE/2, SIZE/2, 3, 3, Terrain.EMPTY_SP );
entrance = SIZE * getWidth() + SIZE / 2 + 1;
map[entrance] = Terrain.ENTRANCE;
setExit(entrance - getWidth() * ( SIZE - 1 ),0);
map[getExit(0)] = Terrain.LOCKED_EXIT;
pedestal = (SIZE / 2 + 1) * (getWidth() + 1);
map[pedestal] = Terrain.PEDESTAL;
map[pedestal-1] = map[pedestal+1] = Terrain.STATUE_SP;
setFeeling(Feeling.NONE);
return true;
}
示例5: tileName
@Override
public String tileName( int tile ) {
switch (tile) {
case Terrain.UNLOCKED_EXIT:
case Terrain.LOCKED_EXIT:
return Game.getVar(R.string.PortalGate_Name);
default:
return super.tileName( tile );
}
}
示例6: build
@Override
protected boolean build() {
Painter.fill( this, _Left(), TOP, HALL_WIDTH, HALL_HEIGHT, Terrain.WATER );
int y = TOP + 1;
while (y < TOP + HALL_HEIGHT) {
map[y * getWidth() + _Center() - 3] = Terrain.STATUE;
map[y * getWidth() + _Center() + 3] = Terrain.STATUE;
y += 2;
}
int pedestal_1 = (TOP + HALL_HEIGHT / 4) * getWidth() + _Center() - 2;
int pedestal_2 = (TOP + HALL_HEIGHT / 2 + HALL_HEIGHT / 4) * getWidth() + _Center() - 2;
int pedestal_3 = (TOP + HALL_HEIGHT / 4) * getWidth() + _Center() + 2;
int pedestal_4 = (TOP + HALL_HEIGHT / 2 + HALL_HEIGHT / 4) * getWidth() + _Center() + 2;
map[pedestal_1] = map[pedestal_2] = map[pedestal_3] = map[pedestal_4] = Terrain.PEDESTAL;
setExit((TOP - 1) * getWidth() + _Center(),0);
arenaDoor = (TOP + HALL_HEIGHT) * getWidth() + _Center();
map[arenaDoor] = Terrain.DOOR;
Painter.fill( this, _Left(), TOP + HALL_HEIGHT + 1, HALL_WIDTH, CHAMBER_HEIGHT, Terrain.WATER );
Painter.fill( this, _Left(), TOP + HALL_HEIGHT + 1, 1, CHAMBER_HEIGHT, Terrain.BOOKSHELF );
Painter.fill( this, _Left() + HALL_WIDTH - 1, TOP + HALL_HEIGHT + 1, 1, CHAMBER_HEIGHT, Terrain.BOOKSHELF );
entrance = (TOP + HALL_HEIGHT + 2 + Random.Int( CHAMBER_HEIGHT - 1 )) * getWidth() + _Left() + (/*1 +*/ Random.Int( HALL_WIDTH-2 ));
map[entrance] = Terrain.ENTRANCE;
map[getExit(0)] = Terrain.LOCKED_EXIT;
return true;
}
示例7: tileName
@Override
public String tileName( int tile ) {
switch (tile) {
case Terrain.WATER:
return Game.getVar(R.string.Prison_TileWater);
case Terrain.HIGH_GRASS:
return Game.getVar(R.string.City_TileHighGrass);
case Terrain.UNLOCKED_EXIT:
case Terrain.LOCKED_EXIT:
return Game.getVar(R.string.PortalGate_Name);
default:
return super.tileName( tile );
}
}
示例8: spawn
public static void spawn(RegularLevel level, Room room) {
NecromancerNPC npc = new NecromancerNPC();
int cell;
do {
cell = room.random(level);
} while (level.map[cell] == Terrain.LOCKED_EXIT);
npc.setPos(cell);
level.spawnMob(npc);
}
示例9: actUnlock
private boolean actUnlock(HeroAction.Unlock action) {
int doorCell = action.dst;
if (Dungeon.level.adjacent(getPos(), doorCell)) {
theKey = null;
int door = Dungeon.level.map[doorCell];
if (door == Terrain.LOCKED_DOOR) {
theKey = belongings.getKey(IronKey.class, Dungeon.depth, Dungeon.level.levelId);
} else if (door == Terrain.LOCKED_EXIT) {
theKey = belongings.getKey(SkeletonKey.class, Dungeon.depth, Dungeon.level.levelId);
}
if (theKey != null) {
spend(Key.TIME_TO_UNLOCK);
getSprite().operate(doorCell);
Sample.INSTANCE.play(Assets.SND_UNLOCK);
} else {
GLog.w(TXT_LOCKED_DOOR);
ready();
}
return false;
} else if (getCloser(doorCell)) {
return true;
} else {
ready();
return false;
}
}
示例10: handle
public boolean handle( int cell ) {
if (cell == -1) {
return false;
}
Char ch;
Heap heap;
if (Dungeon.level.map[cell] == Terrain.ALCHEMY && cell != pos) {
curAction = new HeroAction.Cook( cell );
} else if (Level.fieldOfView[cell] && (ch = Actor.findChar( cell )) instanceof Mob) {
if (ch instanceof NPC) {
curAction = new HeroAction.Interact( (NPC)ch );
} else {
curAction = new HeroAction.Attack( ch );
}
} else if (Level.fieldOfView[cell] && (heap = Dungeon.level.heaps.get( cell )) != null && heap.type != Heap.Type.HIDDEN) {
switch (heap.type) {
case HEAP:
curAction = new HeroAction.PickUp( cell );
break;
case FOR_SALE:
curAction = heap.size() == 1 && heap.peek().price() > 0 ?
new HeroAction.Buy( cell ) :
new HeroAction.PickUp( cell );
break;
default:
curAction = new HeroAction.OpenChest( cell );
}
} else if (Dungeon.level.map[cell] == Terrain.LOCKED_DOOR || Dungeon.level.map[cell] == Terrain.LOCKED_EXIT) {
curAction = new HeroAction.Unlock( cell );
} else if (cell == Dungeon.level.exit) {
curAction = new HeroAction.Descend( cell );
} else if (cell == Dungeon.level.entrance) {
curAction = new HeroAction.Ascend( cell );
} else {
curAction = new HeroAction.Move( cell );
lastAction = null;
}
return act();
}
示例11: handle
public boolean handle( int cell ) {
if (cell == -1) {
return false;
}
Char ch;
Heap heap;
if (Dungeon.level.map[cell] == Terrain.ALCHEMY && cell != pos) {
curAction = new HeroAction.Cook( cell );
} else if (Level.fieldOfView[cell] && (ch = Actor.findChar( cell )) instanceof Mob) {
if (ch instanceof NPC) {
curAction = new HeroAction.Interact( (NPC)ch );
} else {
curAction = new HeroAction.Attack( ch );
}
} else if (Level.fieldOfView[cell] && (heap = Dungeon.level.heaps.get( cell )) != null) {
switch (heap.type) {
case HEAP:
curAction = new HeroAction.PickUp( cell );
break;
case FOR_SALE:
curAction = heap.size() == 1 && heap.peek().price() > 0 ?
new HeroAction.Buy( cell ) :
new HeroAction.PickUp( cell );
break;
default:
curAction = new HeroAction.OpenChest( cell );
}
} else if (Dungeon.level.map[cell] == Terrain.LOCKED_DOOR || Dungeon.level.map[cell] == Terrain.LOCKED_EXIT) {
curAction = new HeroAction.Unlock( cell );
} else if (cell == Dungeon.level.exit) {
curAction = new HeroAction.Descend( cell );
} else if (cell == Dungeon.level.entrance) {
curAction = new HeroAction.Ascend( cell );
} else {
curAction = new HeroAction.Move( cell );
lastAction = null;
}
return act();
}
示例12: handle
public boolean handle(int cell) {
if (doOnNextAction != null) {
doOnNextAction.run();
doOnNextAction = null;
return false;
}
if (!Dungeon.level.cellValid(cell)) {
return false;
}
Char ch;
Heap heap;
if (Dungeon.level.map[cell] == Terrain.ALCHEMY && cell != getPos()) {
curAction = new HeroAction.Cook(cell);
} else if (Dungeon.level.fieldOfView[cell] && (ch = Actor.findChar(cell)) instanceof Mob) {
Mob mob = (Mob) ch;
if (mob.friendly(this)) {
curAction = new HeroAction.Interact(mob);
} else {
curAction = new HeroAction.Attack(ch);
}
} else if ((heap = Dungeon.level.getHeap(cell)) != null) {
switch (heap.type) {
case HEAP:
curAction = new HeroAction.PickUp(cell);
break;
case FOR_SALE:
curAction = heap.size() == 1 && heap.peek().price() > 0 ? new HeroAction.Buy(cell)
: new HeroAction.PickUp(cell);
break;
default:
curAction = new HeroAction.OpenChest(cell);
}
} else if (Dungeon.level.map[cell] == Terrain.LOCKED_DOOR || Dungeon.level.map[cell] == Terrain.LOCKED_EXIT) {
curAction = new HeroAction.Unlock(cell);
} else if (Dungeon.level.isExit(cell)) {
curAction = new HeroAction.Descend(cell);
} else if (cell == Dungeon.level.entrance) {
curAction = new HeroAction.Ascend(cell);
} else {
curAction = new HeroAction.Move(cell);
lastAction = null;
}
return act();
}
示例13: onOperateComplete
@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];
switch (door) {
case Terrain.LOCKED_DOOR:
Dungeon.level.set(doorCell, Terrain.DOOR);
break;
case Terrain.LOCKED_EXIT:
Dungeon.level.set(doorCell, Terrain.UNLOCKED_EXIT);
break;
default:
EventCollector.logException(new Exception("trying to unlock tile:" + door));
}
GameScene.updateMap(doorCell);
} else if (curAction instanceof HeroAction.OpenChest) {
if (theKey != null) {
theKey.detach(belongings.backpack);
theKey = null;
}
Heap heap = Dungeon.level.getHeap(((HeroAction.OpenChest) curAction).dst);
if (heap != null) {
if (heap.type == Type.SKELETON) {
Sample.INSTANCE.play(Assets.SND_BONES);
}
heap.open(this);
}
}
curAction = null;
super.onOperateComplete();
}
示例14: actUnlock
private boolean actUnlock( HeroAction.Unlock action ) {
int doorCell = action.dst;
if (Level.adjacent( pos, doorCell )) {
theKey = null;
int door = Dungeon.level.map[doorCell];
if (door == Terrain.LOCKED_DOOR) {
theKey = belongings.getKey( IronKey.class, Dungeon.depth );
} else if (door == Terrain.LOCKED_EXIT) {
theKey = belongings.getKey( SkeletonKey.class, Dungeon.depth );
}
if (theKey != null) {
spend( Key.TIME_TO_UNLOCK );
sprite.operate( doorCell );
Sample.INSTANCE.play( Assets.SND_UNLOCK );
} else {
GLog.w( TXT_LOCKED_DOOR );
ready();
}
return false;
} else if (getCloser( doorCell )) {
return true;
} else {
ready();
return false;
}
}