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


Java Rect.getPoints方法代码示例

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


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

示例1: canConnect

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public boolean canConnect( Room r ){
	Rect i = intersect( r );

	boolean foundPoint = false;
	for (Point p : i.getPoints()){
		if (canConnect(p) && r.canConnect(p)){
			foundPoint = true;
			break;
		}
	}
	if (!foundPoint) return false;

	if (i.width() == 0 && i.left == left)
		return canConnect(LEFT) && r.canConnect(LEFT);
	else if (i.height() == 0 && i.top == top)
		return canConnect(TOP) && r.canConnect(TOP);
	else if (i.width() == 0 && i.right == right)
		return canConnect(RIGHT) && r.canConnect(RIGHT);
	else if (i.height() == 0 && i.bottom == bottom)
		return canConnect(BOTTOM) && r.canConnect(BOTTOM);
	else
		return false;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:24,代码来源:Room.java

示例2: placeDoors

import com.watabou.utils.Rect; //导入方法依赖的package包/类
private void placeDoors( Room r ) {
	for (Room n : r.connected.keySet()) {
		Room.Door door = r.connected.get( n );
		if (door == null) {

			Rect i = r.intersect( n );
			ArrayList<Point> doorSpots = new ArrayList<>();
			for (Point p : i.getPoints()){
				if (r.canConnect(p) && n.canConnect(p))
					doorSpots.add(p);
			}
			door = new Room.Door(Random.element(doorSpots));

			r.connected.put( n, door );
			n.connected.put( r, door );
		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:19,代码来源:RegularPainter.java

示例3: canConnect

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public boolean canConnect( Room r ){
	Rect i = intersect( r );
	
	boolean foundPoint = false;
	for (Point p : i.getPoints()){
		if (canConnect(p) && r.canConnect(p)){
			foundPoint = true;
			break;
		}
	}
	if (!foundPoint) return false;
	
	if (i.width() == 0 && i.left == left)
		return canConnect(LEFT) && r.canConnect(LEFT);
	else if (i.height() == 0 && i.top == top)
		return canConnect(TOP) && r.canConnect(TOP);
	else if (i.width() == 0 && i.right == right)
		return canConnect(RIGHT) && r.canConnect(RIGHT);
	else if (i.height() == 0 && i.bottom == bottom)
		return canConnect(BOTTOM) && r.canConnect(BOTTOM);
	else
		return false;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:24,代码来源:Room.java

示例4: placeDoors

import com.watabou.utils.Rect; //导入方法依赖的package包/类
private void placeDoors( Room r ) {
	for (Room n : r.connected.keySet()) {
		Room.Door door = r.connected.get( n );
		if (door == null) {
			
			Rect i = r.intersect( n );
			ArrayList<Point> doorSpots = new ArrayList<>();
			for (Point p : i.getPoints()){
				if (r.canConnect(p) && n.canConnect(p))
					doorSpots.add(p);
			}
			if (doorSpots.isEmpty()){
				ShatteredPixelDungeon.reportException(
						new RuntimeException("Could not place a door! " +
								"r=" + r.getClass().getSimpleName() +
								" n=" + n.getClass().getSimpleName()));
				continue;
			}
			door = new Room.Door(Random.element(doorSpots));
			
			r.connected.put( n, door );
			n.connected.put( r, door );
		}
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:26,代码来源:RegularPainter.java


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