Package manager

Examples of manager.MapManager


    super();
    this.playerManager = new PlayerManager();
    this.baseManager = new BaseManager();
    this.agentManager = new AgentManager();
    this.towerManager = new TowerManager();
    this.mapManager = new MapManager();
    this.running = true;
  }
View Full Code Here


      case 9:
      case 2:
        // Je veux poser une tour sur une de mes zones : je regarde et retiens tous les endroits disponibles
       
        LinkedList<Integer[]> availableAreas = new LinkedList<Integer[]>();
        MapManager mapManager = Game.getInstance().getMapManager();
       
        for(int j=0; j < mapManager.getHeightMap(); ++j) {
          for(int i=0; i < mapManager.getHeightMap(); ++i) {
           
            int numArea = mapManager.getMap()[i][j];
           
            if(numArea >= 0 && numArea < Game.getInstance().getBaseManager().getBases().size()) {
              Base baseArea = Game.getInstance().getBaseManager().getBases().get(numArea);
              // si la zone est disponible pour moi je l'ajoute à la liste
              if (this.equals(baseArea.getPlayer())) {
                Integer[] position = {i, j};
                availableAreas.add(position);
              }
            }
          }
        }
       
        // si on a trouvé au moins une zone disponible on en prend une au hasard et on construit la base dessus (si l'argent le permet)
        if (availableAreas.size() != 0) {
          int randIndex = rand.nextInt(availableAreas.size());
          int randX = (availableAreas.get(randIndex)[0] * AppliWindow.getInstance().getWidth()) / mapManager.getWidthMap();
          int randY = (availableAreas.get(randIndex)[1] * AppliWindow.getInstance().getHeight()) / mapManager.getHeightMap();
         
          this.buyTower(this, "GunTower", randX, randY);
        }
       
        break;
View Full Code Here

TOP

Related Classes of manager.MapManager

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.