예제 #1
0
파일: Player.java 프로젝트: marshauf/uni
 @Override
 public void read(Json json, JsonValue jsonData) {
   Iterator<JsonValue> iter = jsonData.iterator();
   JsonValue value;
   while (iter.hasNext()) {
     value = iter.next();
     switch (value.name()) {
       case "name":
         name = value.asString();
         break;
       case "dir":
         dir.x = value.get("x").asFloat();
         dir.y = value.get("x").asFloat();
         break;
       case "speed":
         speed = value.asFloat();
         break;
       case "bounds":
         bounds.width = value.getFloat("width");
         bounds.height = value.getFloat("height");
         setPosition(
             new Vector2(
                 value.getFloat("x") + bounds.width / 2, value.getFloat("y") + bounds.height / 2));
         break;
       case "score":
         score.read(json, value);
         break;
     }
   }
 }