Package com.drakulo.games.ais.core.building

Examples of com.drakulo.games.ais.core.building.Building


    return pb;
  }

  public static Image getRoadGfx(Building road) throws SlickException {
    // Retreiving neighbors data
    Building neighbor1 = GameData.getSelectedColony().getBuildingAt(
        road.getX(), road.getY() - 1);
    Building neighbor2 = GameData.getSelectedColony().getBuildingAt(
        road.getX() + 1, road.getY());
    Building neighbor3 = GameData.getSelectedColony().getBuildingAt(
        road.getX(), road.getY() + 1);
    Building neighbor4 = GameData.getSelectedColony().getBuildingAt(
        road.getX() - 1, road.getY());

    // Beware, funky binary code ahead!
    int data = 0;
    if (neighbor1 != null) {
View Full Code Here


  public String getGfxKey() {
    return this.building.getType().toString().toLowerCase();
  }

  public BuildingAction clone() {
    Building b = this.building.clone();
    return new BuildingAction(this.getColony(), this.getCostMap(), b, this.getDuration(),
        this.getRobotsUsed(), this.isUpgrade);
  }
View Full Code Here

        // Robots associated to the construction / update have to be
        // released
        c.releaseRobots(action.getRobotsUsed());

        // We have to update the building list in the game data.
        Building building = action.getBuilding();

        if (action.isUpgrade()) {
          building.upgrade();// Uprade
          building.setUpgrading(false); // The upgrading is done
        } else {
          // If the created building is unique, a flag must be set
          if (BuildingType.RESEARCH_CENTER.equals(building.getType())) {
            c.setResearchCenterBuilt(true);
          }

          building.setUnderConstruction(false);

          // Creation
          c.addBuilding(building);
        }
        SoundHelper.playSound(SoundHelper.BUILDING_END);
View Full Code Here

      }
    }

    // Buildings under construction
    for (BuildingAction action : buildingActions) {
      Building b = action.getBuilding();
      if (b.getX() == x && b.getY() == y) {
        return false;
      }
    }

    return true;
View Full Code Here

        return b;
      }
    }
    // No building was found. May be there is a building under construction?
    for (BuildingAction action : buildingActions) {
      Building b = action.getBuilding();
      if (b != null && b.getX() == x && b.getY() == y) {
        return b;
      }
    }

    return null;
View Full Code Here

            // No building, but is there a building under
            // construction?
            List<BuildingAction> bactions = GameData
                .getSelectedColony().getBuildingActions();
            for (BuildingAction cba : bactions) {
              Building cb = cba.getBuilding();
              if (cb.getX() == tileX && cb.getY() == tileY) {
                // Construction is impossible
                canBuild = false;
                break;
              }
            }
View Full Code Here

    // Constructions in progress
    List<BuildingAction> actions = GameData.getSelectedColony()
        .getBuildingActions();
    for (BuildingAction action : actions) {
      Building b = action.getBuilding();
      Image gfx = null;
      if (BuildingType.ROAD.equals(b.getType())) {
        // Road are rendered according to the neighbors buildings
        gfx = UIHelper.getRoadGfx(b);
      } else {
        gfx = ImageManager.getGfx(b.getType().toString());
      }
      gfx.draw(getScreenX(b.getX()), getScreenY(b.getY()), new Color(
          0.5F, 0.5F, 0.5F, 0.5F));

      // Render the construction progress bar
      int progress = action.getProgression();
      int x = getScreenX(b.getX());
      int y = getScreenY(b.getY());
      int width = NumberHelper.ruleOf3(100, Settings.TILE_SIZE, progress);

      if (action.isUpgrade()) {
        // Update : yellow
        g.setColor(Color.magenta);
      } else {
        // Creation : red
        g.setColor(Color.red);
      }
      g.drawLine(x, y, x + width, y);
      g.drawLine(x, y + 1, x + width, y + 1);
      g.drawLine(x, y + 2, x + width, y + 2);

      if (b.equals(this.selectedBuilding)) {
        highlightBuilding(g, b);
      }
    }

    // Robots
View Full Code Here

TOP

Related Classes of com.drakulo.games.ais.core.building.Building

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.