public BalconyRail(BalconyFloor parent) : base("balcony_rail") { parentFloor = parent; var height = 1f; boundaries = new Vector3[8]; boundaries[0] = parentFloor.boundaries[4]; boundaries[1] = parentFloor.boundaries[5]; boundaries[2] = boundaries[1] - parentFloor.depth * parentFace.normal; boundaries[3] = boundaries[0] - parentFloor.depth * parentFace.normal; for (var i = 0; i < 4; ++i) boundaries[i + 4] = boundaries[i] + height * Vector3.up; FindMeshOrigin(boundaries[0], boundaries[6], boundaries[2], boundaries[4]); for (var i = 0; i < boundaries.Length; ++i) boundaries[i] -= meshOrigin; }
public BalconyRail (BalconyFloor parent) : base("balcony_rail") { parentFloor = parent; var height = 1f; boundaries = new Vector3[8]; boundaries[0] = parentFloor.boundaries[4]; boundaries[1] = parentFloor.boundaries[5]; boundaries[2] = boundaries[1] - parentFloor.depth * parentFace.normal; boundaries[3] = boundaries[0] - parentFloor.depth * parentFace.normal; for (var i = 0; i < 4; ++i) boundaries[i + 4] = boundaries[i] + height * Vector3.up; FindMeshOrigin(boundaries[0], boundaries[6], boundaries[2], boundaries[4]); for (var i = 0; i < boundaries.Length; ++i) boundaries[i] -= meshOrigin; }
/*************** CONSTRUCTORS ***************/ public Balcony(Face parent, Vector3 dr, Vector3 dl, ComponentCoordinate position) : base(parent, position) { height = parentBuilding.balconyHeight; width = (dr - dl).magnitude; depth = 0.2f; if (masterParent.balconyWidth > 0f) { var mod = (masterParent.balconyWidth - width) / 2f; width = masterParent.balconyWidth; dr += mod * parentFace.right; dl -= mod * parentFace.right; } boundaries = new Vector3[4]; boundaries[0] = dr; boundaries[1] = dl; boundaries[2] = new Vector3(dl.x, dl.y + height, dl.z); boundaries[3] = new Vector3(dr.x, dr.y + height, dr.z); frame = new BalconyFrame(this); frame.name = "neo_balcony_frame"; frame.material = MaterialManager.Instance.Get("ComponentFrame"); parentBuilding.parent.AddCombinable(frame.material.name, frame); body = new BalconyBody(this); body.name = "neo_balcony_body"; body.material = parentBuilding.parent.balconyDoorMaterial; parentBuilding.parent.AddCombinable(body.material.name, body); balconyFloor = new BalconyFloor(this); balconyFloor.name = "neo_balcony_floor"; balconyFloor.material = parentBuilding.material; parentBuilding.parent.AddCombinable(balconyFloor.material.name, balconyFloor); balconyRail = new BalconyRail(balconyFloor); balconyRail.name = "neo_balcony_rail"; balconyRail.material = MaterialManager.Instance.Get("mat_balcony_rail"); parentBuilding.parent.AddCombinable(balconyRail.material.name, balconyRail); rightShutter = new Shutter(this, ShutterSide.Right); rightShutter.name = "bal_right_shutter"; rightShutter.material = parentBuilding.parent.shutterMaterial; parentBuilding.parent.AddCombinable(rightShutter.material.name, rightShutter); leftShutter = new Shutter(this, ShutterSide.Left); leftShutter.name = "bal_left_shutter"; leftShutter.material = parentBuilding.parent.shutterMaterial; parentBuilding.parent.AddCombinable(leftShutter.material.name, leftShutter); if (position.floor >= 1) { decor = new ComponentDecor(this); decor.name = "window_decor"; decor.material = parentBuilding.parent.compDecorMaterial; parentBuilding.parent.AddCombinable(decor.material.name, decor); } else { decor = new ComponentDecor(this, true); decor.name = "window_decor"; decor.material = parentBuilding.parent.simpleCompDecorMaterial; parentBuilding.parent.AddCombinable(decor.material.name, decor); } }
/*************** CONSTRUCTORS ***************/ public Balcony (Face parent, Vector3 dr, Vector3 dl, ComponentCoordinate position) : base(parent, position) { height = parentBuilding.balconyHeight; width = (dr - dl).magnitude; depth = 0.2f; if (masterParent.balconyWidth > 0f) { var mod = (masterParent.balconyWidth - width) / 2f; width = masterParent.balconyWidth; dr += mod * parentFace.right; dl -= mod * parentFace.right; } boundaries = new Vector3[4]; boundaries[0] = dr; boundaries[1] = dl; boundaries[2] = new Vector3(dl.x, dl.y + height, dl.z); boundaries[3] = new Vector3(dr.x, dr.y + height, dr.z); frame = new BalconyFrame(this); frame.name = "neo_balcony_frame"; frame.material = MaterialManager.Instance.Get("ComponentFrame"); parentBuilding.parent.AddCombinable(frame.material.name, frame); body = new BalconyBody(this); body.name = "neo_balcony_body"; body.material = parentBuilding.parent.balconyDoorMaterial; parentBuilding.parent.AddCombinable(body.material.name, body); balconyFloor = new BalconyFloor(this); balconyFloor.name = "neo_balcony_floor"; balconyFloor.material = parentBuilding.material; parentBuilding.parent.AddCombinable(balconyFloor.material.name, balconyFloor); balconyRail = new BalconyRail(balconyFloor); balconyRail.name = "neo_balcony_rail"; balconyRail.material = MaterialManager.Instance.Get("mat_balcony_rail"); parentBuilding.parent.AddCombinable(balconyRail.material.name, balconyRail); rightShutter = new Shutter(this, ShutterSide.Right); rightShutter.name = "bal_right_shutter"; rightShutter.material = parentBuilding.parent.shutterMaterial; parentBuilding.parent.AddCombinable(rightShutter.material.name, rightShutter); leftShutter = new Shutter(this, ShutterSide.Left); leftShutter.name = "bal_left_shutter"; leftShutter.material = parentBuilding.parent.shutterMaterial; parentBuilding.parent.AddCombinable(leftShutter.material.name, leftShutter); if (position.floor >= 1) { decor = new ComponentDecor(this); decor.name = "window_decor"; decor.material = parentBuilding.parent.compDecorMaterial; parentBuilding.parent.AddCombinable(decor.material.name, decor); } else { decor = new ComponentDecor(this, true); decor.name = "window_decor"; decor.material = parentBuilding.parent.simpleCompDecorMaterial; parentBuilding.parent.AddCombinable(decor.material.name, decor); } }