コード例 #1
0
 private EyeViewport initViewportForEye(final FieldOfView fov, final float xOffset) {
   final float left = (float) Math.tan(Math.toRadians(fov.getLeft()));
   final float right = (float) Math.tan(Math.toRadians(fov.getRight()));
   final float bottom = (float) Math.tan(Math.toRadians(fov.getBottom()));
   final float top = (float) Math.tan(Math.toRadians(fov.getTop()));
   final EyeViewport vp = new EyeViewport();
   vp.x = xOffset;
   vp.y = 0.0f;
   vp.width = left + right;
   vp.height = bottom + top;
   vp.eyeX = left + xOffset;
   vp.eyeY = bottom;
   return vp;
 }
コード例 #2
0
ファイル: Matrix.java プロジェクト: prafaelo/jacas
  public void generateItemsCluster() {
    if (getItemsCluster().size() > 0) {
      throw new RuntimeException("Erro!");
    }

    for (Cell cell : getCells().values()) {

      Item item = cell.getObjectsItem();
      if (item != null) {
        FieldOfView fieldOfView = new FieldOfView(cell);
        Item keyItensCluster = null;
        Item keyItensClusterFOV = null;
        for (Cell cellOfFOV : fieldOfView.getCells().values()) {
          Item itemFOV = cellOfFOV.getObjectsItem();
          if (itemFOV != null) {
            keyItensCluster = item.getkeyItensCluster();
            keyItensClusterFOV = itemFOV.getkeyItensCluster();

            if (keyItensClusterFOV != null) {

              if (keyItensCluster != null) {
                if (keyItensCluster != keyItensClusterFOV) {

                  Collection<Item> itemsClusterFOVColl = itemsCluster.get(keyItensClusterFOV);
                  for (Item itemsClusterFOV : itemsClusterFOVColl) {
                    itemsClusterFOV.setKeyItensCluster(keyItensCluster);
                  }
                  itemsCluster.get(keyItensCluster).addAll(itemsClusterFOVColl);
                  itemsCluster.remove(keyItensClusterFOV);
                }
              } else {
                item.setKeyItensCluster(keyItensClusterFOV);
                Collection<Item> coll = itemsCluster.get(keyItensClusterFOV);
                coll.add(item);
              }
            }
          }
        }
        if (keyItensCluster == null && keyItensClusterFOV == null) {
          item.setKeyItensCluster(item);
          Set<Item> ItemsClusterCollection = new HashSet<Item>();
          ItemsClusterCollection.add(item);
          itemsCluster.put(item, ItemsClusterCollection);
        }
      }
    }
  }
コード例 #3
0
 public boolean doAction(FieldOfView game) {
   addActionPositionAtActor(game);
   game.killPiece(getPlayerNum(), getActor(), true);
   return true;
 }