コード例 #1
0
  public void createField(Map map, Vector2D startVector, int terrainType, int size) {
    Vector2D position = startVector;

    for (int i = 0; i < size; i++) {
      position = position.add(Vector2D.create(-1 + Random.getInt(3), -1 + Random.getInt(3)));

      Cell cellProtected = map.getCellProtected(position.getXAsInt(), position.getYAsInt());
      if (!cellProtected.getMapCoordinate().equals(position)) {
        position = cellProtected.getMapCoordinate();
      }

      putTerrainOnCell(map, position.getXAsInt(), position.getYAsInt(), terrainType);
    }
  }