Esempio n. 1
0
 @Override
 public List<StructurePiece> getNextComponents() {
   final List<StructurePiece> components = new ArrayList<StructurePiece>(1);
   final StructurePiece component;
   final float draw = getRandom().nextFloat();
   if (draw > 0.8) {
     final MineshaftRoom room = new MineshaftRoom(parent);
     room.randomize();
     room.setPosition(position.add(rotate(-room.getLenght() / 2 + 1, -1, sections * 5)));
     component = room;
   } else if (draw > 0.6) {
     component = new MineshaftStaircase(parent);
     component.setPosition(position.add(rotate(0, 0, sections * 5)));
     component.randomize();
   } else if (draw > 0.1) {
     component = new MineshaftIntersection(parent);
     component.setPosition(position.add(rotate(0, 0, sections * 5)));
     component.randomize();
   } else {
     return components;
   }
   component.setRotation(rotation);
   components.add(component);
   return components;
 }
Esempio n. 2
0
 @Override
 public List<StructurePiece> getNextPieces() {
   final StructurePiece piece = getNextPiece();
   if (left) {
     piece.setPosition(position.add(rotate(5, 0, 4)));
     piece.setRotation(Quaternionf.fromAngleDegAxis(90, 0, 1, 0).mul(rotation));
   } else {
     piece.setPosition(position.add(rotate(-1, 0, 0)));
     piece.setRotation(Quaternionf.fromAngleDegAxis(-90, 0, 1, 0).mul(rotation));
   }
   piece.randomize();
   return Lists.newArrayList(piece);
 }
 @Override
 public List<StructurePiece> getNextPieces() {
   final List<StructurePiece> pieces = new ArrayList<StructurePiece>(3);
   final StructurePiece front = getNextPiece();
   front.setPosition(position.add(rotate(0, 0, 5)));
   front.setRotation(rotation);
   front.randomize();
   pieces.add(front);
   final StructurePiece right = getNextPiece();
   right.setPosition(position.add(rotate(-1, 0, 0)));
   right.setRotation(Quaternionf.fromAngleDegAxis(-90, 0, 1, 0).mul(rotation));
   right.randomize();
   pieces.add(right);
   final StructurePiece left = getNextPiece();
   left.setPosition(position.add(rotate(5, 0, 4)));
   left.setRotation(Quaternionf.fromAngleDegAxis(90, 0, 1, 0).mul(rotation));
   left.randomize();
   pieces.add(left);
   return pieces;
 }