public void showUnit(String[] parts){
      int current = 1;
      
      //go through the parts accordingly, starting with parts[1] which is unitType
      int type = Integer.parseInt(parts[current]);
      current++;
      //if the unitType hasnt been initialized yet, initialize it, otherwise just create a new unit with the template
      if(unitTypes[type]==null){
          Unit template = initializeUnit(type);
          unitTypes[type] = template;
      }
      Unit unit = unitTypes[type].clone();
      unit.game = this;
      
      //next part should be unitID (part 2)
      unit.id = Integer.parseInt(parts[current]);
      current++;
      
//      System.out.println("Main : showUnit : unit has " + unit.abilityPoints + " abilityPoints");
      
      if(unit.id==15){
          System.out.println("REVEALED");
      }
      
      
      
//      rootNode.attachChild(unit.model);
      
      //next part should be unit position (part 3)
      //since its an array of information, split it up by ","
//      System.out.println(parts[current]);
//      System.out.println(current);
      String[] split = parts[current].split(",");
      current++;
      //A THING TO REMEMBER, x on server is z on client and y on server is x on client
//      float[] pos = new float[]{Float.parseFloat(split[1]), Float.parseFloat(split[0])};
      float[] pos = new float[]{Float.parseFloat(split[1])/10, Float.parseFloat(split[0])/10};
      unit.setPosition(pos);
      int fogNodeX = (int)unit.model.getLocalTranslation().z/50;
      int fogNodeY = (int)unit.model.getLocalTranslation().x/50;
      fogNodes[fogNodeX][fogNodeY].attachChild(unit.model);
      unit.updateEffects();
      
      //next part should be unit angle (part 4)
      float angle = Float.parseFloat(parts[current]);
      current++;
      unit.setFacing(angle);
      
      //next part should be unit current health (part 5)
      unit.health = Double.parseDouble(parts[current]);
//      if(type==3){
//          System.out.println("Main : showUnit : health = " + Double.parseDouble(parts[current]));
//      }
      current++;
      
      //next part should be unit current mana (part 5)
      unit.mana = Double.parseDouble(parts[current]);
      current++;
      
      
//      System.out.println("Main : showUnit : unit has " + unit.abilityPoints + " abilityPoints");
      
      //just a check, does the unit model have a unitcontrol attached to it?
//      if(unit.model.getControl(UnitControl.class)!=null){
//          System.out.println("The model has a UnitControl attached to it");
//          System.out.println(unit.model.getName());
//      }
      
      //String realName = unit.model.getName();
      
      
      if(!unit.noAnimation){
          unit.channel.setAnim(unit.idleAnimation, 0.5f);
          unit.channel.setLoopMode(LoopMode.Cycle);
      }
      
      
      /*
      Spatial child = rootNode.getChild(realName);
      if(child==null){
          System.out.println("ASSO JAG QUITTAR");
      }
      else{
          System.out.println("Amount of children = " + rootNode.getQuantity());
          System.out.println("Name of last = " + rootNode.getChild(rootNode.getQuantity()-1));
      }
      */
      units.add(unit);
      
      unit.heroLevel = Integer.parseInt(parts[current]);
      current++;
      if(unit.heroLevel>0){
          unit.isHero = true;
      }
      
//      System.out.println("Main : showUnit : unit is level " + unit.heroLevel);
//      System.out.println("Main : showUnit : unit has " + unit.abilityPoints + " abilityPoints");
      
      //items
      current++;
      
      //buffs ids
      String[] splitIDs = parts[current].split(",");
      current++;
      
      //buff durations
      String[] splitDurations = parts[current].split(",");
      current++;
      
      String[] splitStacks = parts[current].split(",");
      current++;
      
      String[] splitVars = parts[current].split(",");
      current++;
      
      //Generate the buffs
      for(int a=0;a<splitIDs.length;a++){
          int id = Integer.parseInt(splitIDs[a]);
          if(id==-1){
              break;
          }
          String[] divideVars = splitVars[a].split("#");
          int[] vars = new int[divideVars.length];
          for(int b=0;b<divideVars.length;b++){
              vars[b] = Integer.parseInt(divideVars[b]);
          }
          
          Buff b = new Buff(Integer.parseInt(splitIDs[a]), vars);
          b.duration = Float.parseFloat(splitDurations[a])+elapsedTime;
          b.stacks = Integer.parseInt(splitStacks[a]);
          unit.applyBuff(b);
      }
      
      //next should be team
      unit.team = Integer.parseInt(parts[current]);
      current++;
      
      if(unit.team==playerTeam){
        //what FogNode is this unit on?
        float x = unit.model.getWorldTranslation().z;
        float y = unit.model.getWorldTranslation().x;
        //convert floats to ints
        int ix = (int)x;
        int iy = (int)y;
        //divide them by 5
        int fx = ix/5;
        int fy = iy/5;
        //get the FogNode
        FogNode fn = fog[fx][fy];
        updateVision(fn, unit.sight);
        unit.fogX = fx;
        unit.fogY = fy;
      }
      else{
          unit.fogX = ((int)unit.model.getWorldTranslation().z)/5;
          unit.fogY = ((int)unit.model.getWorldTranslation().x)/5;
      }
      
      unit.player = Integer.parseInt(parts[current]);
      current++;
      
      //next should be attack cooldown
      unit.attackCooldownTo = Float.parseFloat(parts[current]);
      current++;
  }