Ejemplo n.º 1
0
  public void TouchGame(float x, float y) {
    int count = 0;
    if (y > (int) m_Height - (int) m_Height / 6) {
      for (int i = 0; i < UI.Button.size(); i++) {
        if (UI.Button.get(i).Collusion(m_click_x, m_click_y, UI.rsizex, UI.rsizey)) {
          m_UI_Touch_Postion = i;
        }
      }
    } else {
      for (int i = 0; i < 50; i++) {
        for (int j = 0; j < 50; j++) {
          Unit temp;
          if (tileColl
                      .get(count)
                      .resultCal(m_click_x / m_matrix_x - m_diffX, m_click_y / m_matrix_y - m_diffY)
                  == true
              && UnitValue.m_bmap[i][j] != MapState.NotMove) {
            //  UnitValue.m_map[i][j]=3;
            // 점핑 트랩 생산
            switch (UI.CheckTable.get(m_UI_Touch_Postion).retruncode()) {
              case UnitValue.F_ROCK1:
                // CreateRock(i, j);

                break;
              case UnitValue.F_ROCKE2:
                // CreateRock2(i, j);

                break;
              case UnitValue.F_TREE1:
                //  CreateTree1(i, j);

                break;
              case UnitValue.F_TOWER:
                CreateUnit.CreateArchorTower(i, j, Units.MyUnits, Units.EnemyUnits, true);
                break;
              case UnitValue.F_BOOM:
                CreateUnit.CreateBoom(i, j, Units.MyUnits);
                break;
              case UnitValue.F_ELSATOWER:
                Unit temped = new Unit(GraphicManager.getInstance().mElsa_Tower.m_bitmap);
                CreateUnit.CreateMagicTower(i, j, temped, Units.MyUnits, Units.EnemyUnits, false);
                break;
              case UnitValue.F_ANNA:
                CreateUnit.CreateAnna(i, j, Units.MyUnits, Units.EnemyUnits, false);
                break;
            }
          }
          count++;
        }
      }
    }
  }
Ejemplo n.º 2
0
  public void LoadMap(String a) {
    String[] result = a.split("=");
    String[] imfors;
    for (int i = 0; i < result.length; i++) {

      int x = 0;
      int y = 0;
      int level = 0;
      int type = 0;
      imfors = result[i].split("a");

      x = Integer.parseInt(imfors[0]);
      y = Integer.parseInt(imfors[1]);
      level = Integer.parseInt(imfors[2]);
      type = Integer.parseInt(imfors[3]);
      switch (type) {
        case UnitValue.F_TOWER:
          CreateUnit.CreateArchorTower(x, y, Units.MyUnits, Units.EnemyUnits, false);
          break;
        case UnitValue.F_JUMPINGTRAP:
          break;
        case UnitValue.F_ZOMBIE:
          break;
        case UnitValue.F_GOLDRUN:
          break;
        case UnitValue.F_ELSATOWER:
          Unit temp = new Unit(GraphicManager.getInstance().mElsa_Tower.m_bitmap);
          CreateUnit.CreateMagicTower(x, y, temp, Units.MyUnits, Units.EnemyUnits, false);
          break;
        case UnitValue.F_ANNA:
          CreateUnit.CreateAnna(x, y, Units.MyUnits, Units.EnemyUnits, false);
          break;
        case UnitValue.F_TOWNHALL:
          break;
        case UnitValue.F_TREE1:
          CreateUnit.CreateTree1(x, y, Units.Enviroment);
          break;

        case UnitValue.F_ROCK1:
          CreateUnit.CreateRock(x, y, Units.Enviroment);

          break;
        case UnitValue.F_ROCKE2:
          CreateUnit.CreateRock2(x, y, Units.Enviroment);
          break;
        case UnitValue.F_BOOM:
          CreateUnit.CreateBoom(x, y, Units.EnemyUnits);
          break;
      }
    }
  }