Esempio n. 1
0
  /*************** CONSTRUCTORS ***************/

  public BalconyFloor (Balcony parent)
  {
    parentBalcony = parent;

    height = parentBuilding.balconyFloorHeight;
    width = parentBuilding.balconyFloorWidth;
    depth = parentBuilding.balconyFloorDepth;

    var tmp_right = parentBalcony.parentFace.right * width;
    var tmp_normal = parentBalcony.parentFace.normal * depth;
    var tmp_up = -(height - 0.01f) * Vector3.up;

    boundaries = new Vector3[8];
    boundaries[0] = parentBalcony.boundaries[0] + tmp_right + tmp_normal + tmp_up;
    boundaries[1] = parentBalcony.boundaries[1] - tmp_right + tmp_normal + tmp_up;
    boundaries[2] = parentBalcony.boundaries[1] - tmp_right - tmp_normal + tmp_up;
    boundaries[3] = parentBalcony.boundaries[0] + tmp_right - tmp_normal + tmp_up;

    for (var i = 0; i < 4; ++i)
      boundaries[i + 4] = boundaries[i] + Vector3.up * height;

    FindMeshOrigin(boundaries[0],
                   boundaries[6],
                   boundaries[2],
                   boundaries[4]);

    for (var i = 0; i < boundaries.Length; ++i)
      boundaries[i] -= meshOrigin;
  }
        /*************** CONSTRUCTORS ***************/
        public BalconyFloor(Balcony parent)
        {
            parentBalcony = parent;

            height = parentBuilding.balconyFloorHeight;
            width = parentBuilding.balconyFloorWidth;
            depth = parentBuilding.balconyFloorDepth;

            var tmp_right = parentBalcony.parentFace.right * width;
            var tmp_normal = parentBalcony.parentFace.normal * depth;
            var tmp_up = -(height - 0.01f) * Vector3.up;

            boundaries = new Vector3[8];
            boundaries[0] = parentBalcony.boundaries[0] + tmp_right + tmp_normal + tmp_up;
            boundaries[1] = parentBalcony.boundaries[1] - tmp_right + tmp_normal + tmp_up;
            boundaries[2] = parentBalcony.boundaries[1] - tmp_right - tmp_normal + tmp_up;
            boundaries[3] = parentBalcony.boundaries[0] + tmp_right - tmp_normal + tmp_up;

            for (var i = 0; i < 4; ++i)
              boundaries[i + 4] = boundaries[i] + Vector3.up * height;

            FindMeshOrigin(boundaries[0],
                   boundaries[6],
                   boundaries[2],
                   boundaries[4]);

            for (var i = 0; i < boundaries.Length; ++i)
              boundaries[i] -= meshOrigin;
        }