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