Beispiel #1
0
  public void endDrag() {
    System.out.println("END DRAG!");

    ArrayList doodads = new ArrayList();

    for (int i = 0; i < getSelectionCircles().size(); i++) {
      Doodad d = getSelectionCircles().get(i).getDoodad();

      doodads.add(d);
    }

    editorApp.addUndo(new MoveDoodads(doodads, dragStartPositions, editorApp));
    editorApp.nextIsBreak();

    dragStartPositions = new ArrayList();
  }
Beispiel #2
0
  public void delete() {
    /*
    while(getSelectionCircles().size()>0)
     {
         SelectionCircle sc = getSelectionCircles().get(0);
         sc.getDoodad().removeSpace(editorApp.getPathingManager().getPathingMap());
         sc.getDoodad().remove();
         sc.close();
         getSelectionCircles().remove(0);
     }
      *
      */

    DeleteDoodads dd = new DeleteDoodads(this, editorApp);
    editorApp.addUndo(dd);
    editorApp.nextIsBreak();

    dragPositions.clear();
    moveSmooth = true;
  }
Beispiel #3
0
  public void drag(Vector3f location) {
    float changeX = location.x - dragPoint.x;
    float changeY = location.z - dragPoint.y;

    if (moveSmooth) {
      for (int i = 0; i < getSelectionCircles().size(); i++) {
        Doodad d = getSelectionCircles().get(i).getDoodad();

        Vector2f v2f = new Vector2f();
        v2f.x = d.getLocation().x + changeX;
        v2f.y = d.getLocation().z + changeY;

        d.setLocation(v2f, editorApp.getTerrainManager());
        d.updateLocation();

        getSelectionCircles().get(i).update();
      }
    } else {
      for (int i = 0; i < getSelectionCircles().size(); i++) {
        Doodad d = getSelectionCircles().get(i).getDoodad();

        Vector2f v2fold = new Vector2f(d.getLocation().getX(), d.getLocation().getZ());

        Vector2f v2f = dragPositions.get(i);
        v2f.x += changeX;
        v2f.y += changeY;

        d.removeSpace(editorApp.getPathingManager().getPathingMap(), PathingMap.LayerUnit);
        d.setLocation(v2f, editorApp.getTerrainManager());

        if (d.hasSpace(editorApp.getPathingManager().getPathingMap()) == false) {
          d.setLocation(v2fold, editorApp.getTerrainManager());
        }
        d.setSpace(editorApp.getPathingManager().getPathingMap(), PathingMap.LayerUnit);
        d.updateLocation();
        getSelectionCircles().get(i).update();
      }
    }

    dragPoint.setX(location.x);
    dragPoint.setY(location.z);
  }