Exemplo n.º 1
0
    private static void ImportVolumes(XmlDocument xml, BuildrData data)
    {
        foreach(XmlNode node in xml.SelectNodes("buildr/plan/volumes/volume"))
        {
            BuildrVolume volume = ScriptableObject.CreateInstance<BuildrVolume>();
            BuildrVolumeStyles styles = ScriptableObject.CreateInstance<BuildrVolumeStyles>();
            data.plan.volumes.Add(volume);

            foreach(XmlNode pointnode in node.SelectNodes("points/point"))
            {
                volume.points.Add(int.Parse(pointnode.FirstChild.Value));
            }
            foreach(XmlNode pointnode in node.SelectNodes("facades/render"))
            {
                volume.renderFacade.Add(pointnode.FirstChild.Value == valueTrue);
            }
            volume.height = float.Parse(node["height"].FirstChild.Value);
            volume.numberOfFloors = int.Parse(node["numberoffloors"].FirstChild.Value);
            volume.roofDesignID = int.Parse(node["roofdesignid"].FirstChild.Value);

            foreach(XmlNode stylenode in node.SelectNodes("styles/style"))
            {
                int styleID = int.Parse(stylenode["styleid"].FirstChild.Value);
                int facadeID = int.Parse(stylenode["facadeid"].FirstChild.Value);
                int floors = int.Parse(stylenode["floors"].FirstChild.Value);
                styles.AddStyle(styleID, facadeID, floors);
            }
            volume.styles = styles;


            volume.generateStairs = bool.Parse(node["generateStairs"].FirstChild.Value);
            volume.staircaseWidth = float.Parse(node["staircaseWidth"].FirstChild.Value);
            volume.stepHeight = float.Parse(node["stepHeight"].FirstChild.Value);
            volume.stairwellCeilingTexture = int.Parse(node["stairwellCeilingTexture"].FirstChild.Value);
            volume.stairwellFloorTexture = int.Parse(node["stairwellFloorTexture"].FirstChild.Value);
            volume.stairwellStepTexture = int.Parse(node["stairwellStepTexture"].FirstChild.Value);
            volume.stairwellWallTexture = int.Parse(node["stairwellWallTexture"].FirstChild.Value);
            volume.numberOfBasementFloors = int.Parse(node["numberOfBasementFloors"].FirstChild.Value);

            int itemCount = 0;
            foreach (XmlNode basementNode in node.SelectNodes("basementtextures/basementfloortextures"))
            {
                volume.FloorTexture(itemCount, int.Parse(basementNode["FloorTexture"].FirstChild.Value));
                volume.WallTexture(itemCount, int.Parse(basementNode["WallTexture"].FirstChild.Value));
                volume.CeilingTexture(itemCount, int.Parse(basementNode["CeilingTexture"].FirstChild.Value));
                itemCount++;
            }
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// Add new volume point
 /// </summary>
 /// <param name="newPointIndex"></param>
 public void Add(int newPointIndex)
 {
     points.Add(newPointIndex);
     renderFacade.Add(true);
     styles.AddStyle(0, newPointIndex, 1);
 }