Пример #1
0
  @Override
  public int getCostToMove(JGPoint source) {
    // If no cost map specified, return a default value
    if (costMap == null) {
      return DEFAULT_COST;
    }

    // If no cost specified for a given tile, return a default value
    if (!costMap.containsKey(engine.getTileCid(source.x, source.y))) {
      return DEFAULT_COST;
    }

    return costMap.get(engine.getTileCid(source.x, source.y));
  }
Пример #2
0
  /**
   * Check if the given tile index is blocked from allowing movement.
   *
   * @param tile Tile to be checked if it is blocked
   * @return Whether the tile is blocked
   */
  private boolean isTileBlocked(JGPoint tile) {
    // If no blocked list, return false
    if (blockedCIDs == null) {
      return false;
    }

    return blockedCIDs.contains(engine.getTileCid(tile.x, tile.y));
  }