Skip to content

Commit

Permalink
Removed all unused code, added json version
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroHG committed Sep 23, 2022
1 parent b76282f commit 5285720
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 494 deletions.
13 changes: 10 additions & 3 deletions unity/Assets/Scripts/BaseFPSAgentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4560,9 +4560,16 @@ float allowedError
)
);
}
Debug.Log("Before Procedural call");
var floor = ProceduralTools.CreateHouse(house: house, materialDb: materials);


try {
ProceduralTools.CreateHouse(house: house, materialDb: materials);
}
catch (Exception e) {
var msg = $"Exception creating house.\n'{e.Message}'\n'{e.InnerException.Message}'";
Debug.Log(msg);
actionFinished(false, actionReturn: null, errorMessage: msg);
return;
}
actionFinished(true);
}

Expand Down
13 changes: 4 additions & 9 deletions unity/Assets/Scripts/ProceduralData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


namespace Thor.Procedural.Data {
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);

[Serializable]
[MessagePackObject(keyAsPropertyName: true)]
Expand Down Expand Up @@ -130,8 +129,7 @@ public class ProceduralParameters {
tilingDivisorX = 1.0f,
tilingDivisorY = 1.0f
};

public SerializableColor ceilingColor { get; set; } = null;

public float navmeshVoxelSize { get; set; }
public bool ceilingBackFaces { get; set; }

Expand Down Expand Up @@ -178,7 +176,6 @@ public class PolygonWall {
public string layer { get; set; }
public MaterialProperties material;
public bool empty { get; set; } = false;
public SerializableColor color { get; set; } = null;
public bool unlit;
}

Expand Down Expand Up @@ -342,6 +339,7 @@ public class Roof {
[Serializable]
[MessagePackObject(keyAsPropertyName: true)]
public class ProceduralHouse {
public string version;
public ProceduralParameters proceduralParameters { get; set; }
public string id { get; set; }
public List<RoomHierarchy> rooms { get; set; } = new List<RoomHierarchy>();
Expand Down Expand Up @@ -378,8 +376,8 @@ public class MaterialProperties {
public bool unlit { get; set; }
public float? tilingDivisorX = 1.0f;
public float? tilingDivisorY = 1.0f;
public float metallic;
public float smoothness;
public float? metallic;
public float? smoothness;
}

public interface WallRectangularHole {
Expand Down Expand Up @@ -413,9 +411,6 @@ public class Wall {

public string layer { get; set; }

public float materialTilingXDivisor = 1.0f;
public float materialTilingYDivisor = 1.0f;

public SerializableColor color { get; set; } = null;

public bool unlit;
Expand Down
3 changes: 2 additions & 1 deletion unity/Assets/Scripts/ProceduralTemplates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace Thor.Procedural {
public class HouseTemplate {
public string id;
public string layout;
public string version;
public IEnumerable<string> objectsLayouts;
public Dictionary<string, RoomTemplate> rooms;
public Dictionary<string, Thor.Procedural.Data.Door> doors;
Expand Down Expand Up @@ -417,14 +418,14 @@ public static class Templates {
});

return new ProceduralHouse() {
version = houseTemplate.version,
proceduralParameters = houseTemplate.proceduralParameters.DeepClone(),
id = !string.IsNullOrEmpty(houseTemplate.id) ? houseTemplate.id : houseId(),
rooms = roomsWithWalls.Select(p => p.room).ToList(),
walls = roomsWithWalls.SelectMany(p => p.walls).ToList(),
doors = holes.Where(d => d is Data.Door).Select(d => d as Data.Door).ToList(),
windows = holes.Where(d => d is Data.Window).Select(d => d as Data.Window).ToList(),
objects = houseObjects.ToList()

};

}
Expand Down
Loading

0 comments on commit 5285720

Please sign in to comment.