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


Java PathFinder.setMapSize方法代码示例

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


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

示例1: setSize

import com.watabou.utils.PathFinder; //导入方法依赖的package包/类
public void setSize(int w, int h) {

		WIDTH = w;
		HEIGHT = h;
		LENGTH = w * h;

		map = new int[getLength()];
		Arrays.fill(map, Terrain.WALL);
		Arrays.fill(map, feeling == Level.Feeling.CHASM ? Terrain.CHASM : Terrain.WALL);

		visited = new boolean[getLength()];
		mapped = new boolean[getLength()];
		Dungeon.visible = new boolean[getLength()];

		fieldOfView = new boolean[getLength()];

		passable = new boolean[getLength()];
		losBlocking = new boolean[getLength()];
		flamable = new boolean[getLength()];
		secret = new boolean[getLength()];
		solid = new boolean[getLength()];
		avoid = new boolean[getLength()];
		water = new boolean[getLength()];
		pit = new boolean[getLength()];

		PathFinder.setMapSize(w, h);
	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:28,代码来源:Level.java

示例2: switchLevel

import com.watabou.utils.PathFinder; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void switchLevel( final Level level, int pos ) {
	
	Dungeon.level = level;
	Actor.init();

	PathFinder.setMapSize(level.width(), level.height());
	visible = new boolean[level.length()];
	
	Actor respawner = level.respawner();
	if (respawner != null) {
		Actor.add( level.respawner() );
	}

	hero.pos = pos != -1 ? pos : level.exit;
	
	Light light = hero.buff( Light.class );
	hero.viewDistance = light == null ? level.viewDistance : Math.max( Light.DISTANCE, level.viewDistance );
	
	observe();
	try {
		saveAll();
	} catch (IOException e) {
		UNISTPixelDungeon.reportException(e);
		/*This only catches IO errors. Yes, this means things can go wrong, and they can go wrong catastrophically.
		But when they do the user will get a nice 'report this issue' dialogue, and I can fix the bug.*/
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:29,代码来源:Dungeon.java

示例3: switchLevel

import com.watabou.utils.PathFinder; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void switchLevel(final Level level, int pos) {

	PathFinder.setMapSize(level.getWidth(), level.getHeight());

	Dungeon.level = level;
	Actor.init();

	visible = new boolean[level.getLength()];

	Actor respawner = level.respawner();
	if (respawner != null) {
		Actor.add(level.respawner());
	}

	Actor regrower = level.regrower();
	if (regrower != null && growLevel(depth)) {
		Actor.add(level.regrower());
	}

	Actor floordropper = level.floordropper();
	if (floordropper != null && dropLevel(depth)) {
		Actor.add(level.floordropper());
	}

	hero.pos = pos != -1 ? pos : level.exit;

	Light light = hero.buff(Light.class);
	hero.viewDistance = light == null ? level.viewDistance : Math.max(
			Light.DISTANCE, level.viewDistance);

	Actor respawnerPet = level.respawnerPet();
	if (respawnerPet != null) {
		Actor.add(level.respawnerPet());
	}

	hero.curAction = hero.lastAction = null;

	observe();
	try {
		saveAll();
	} catch (IOException e) {
	    /*
            * This only catches IO errors. Yes, this means things can go wrong,
		 * and they can go wrong catastrophically. But when they do the user
		 * will get a nice 'report this issue' dialogue, and I can fix the
		 * bug.
		 */
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:51,代码来源:Dungeon.java

示例4: setupPatch

import com.watabou.utils.PathFinder; //导入方法依赖的package包/类
protected void setupPatch(Level level, float fill, int clustering, boolean ensurePath){

		if (ensurePath){
			PathFinder.setMapSize(width()-2, height()-2);
			boolean valid;
			do {
				patch = Patch.generate(width()-2, height()-2, fill, clustering, true);
				int startPoint = 0;
				for (Door door : connected.values()) {
					if (door.x == left) {
						startPoint = xyToPatchCoords(door.x + 1, door.y);
						patch[xyToPatchCoords(door.x + 1, door.y)] = false;
						patch[xyToPatchCoords(door.x + 2, door.y)] = false;
					} else if (door.x == right) {
						startPoint = xyToPatchCoords(door.x - 1, door.y);
						patch[xyToPatchCoords(door.x - 1, door.y)] = false;
						patch[xyToPatchCoords(door.x - 2, door.y)] = false;
					} else if (door.y == top) {
						startPoint = xyToPatchCoords(door.x, door.y + 1);
						patch[xyToPatchCoords(door.x, door.y + 1)] = false;
						patch[xyToPatchCoords(door.x, door.y + 2)] = false;
					} else if (door.y == bottom) {
						startPoint = xyToPatchCoords(door.x, door.y - 1);
						patch[xyToPatchCoords(door.x, door.y - 1)] = false;
						patch[xyToPatchCoords(door.x, door.y - 2)] = false;
					}
				}

				PathFinder.buildDistanceMap(startPoint, BArray.not(patch, null));

				valid = true;
				for (int i = 0; i < patch.length; i++){
					if (!patch[i] && PathFinder.distance[i] == Integer.MAX_VALUE){
						valid = false;
						break;
					}
				}
			} while (!valid);
			PathFinder.setMapSize(level.getWidth(), level.getHeight());
		} else {
			patch = Patch.generate(width()-2, height()-2, fill, clustering, true);
		}
	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:44,代码来源:PatchRoom.java

示例5: init

import com.watabou.utils.PathFinder; //导入方法依赖的package包/类
public static void init() {

		challenges = PixelDungeon.challenges();
		
		Actor.clear();
		
		PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT );
		
		Scroll.initLabels();
		Potion.initColors();
		Wand.initWoods();
		Ring.initGems();
		
		Statistics.reset();
		Journal.reset();
		
		depth = 0;
		gold = 0;
		
		droppedItems = new SparseArray<ArrayList<Item>>();
		
		potionOfStrength = 0;
		scrollsOfUpgrade = 0;
		scrollsOfEnchantment = 0;
		dewVial = true;
		
		chapters = new HashSet<Integer>();
		
		Ghost.Quest.reset();
		Wandmaker.Quest.reset();
		Blacksmith.Quest.reset();
		Imp.Quest.reset();
		
		Room.shuffleTypes();
		
		QuickSlot.primaryValue = null;
		QuickSlot.secondaryValue = null;
		
		hero = new Hero();
		hero.live();
		
		Badges.reset();
		
		StartScene.curClass.initHero( hero );
	}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:46,代码来源:Dungeon.java


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