示例#1
0
  public Door (Face parent, Vector3 dr, Vector3 dl, ComponentCoordinate position) 
    : base(parent, position)
  {
    height = parentBuilding.doorHeight;
    depth = 0.4f;

    float mod = 0.4f;
    if (masterParent.doorWidth > 0f)
      mod = (masterParent.doorWidth - (dr - dl).magnitude) / 2f;

    dr += mod * parentFace.right;
    dl -= mod * parentFace.right;

    var ul = new Vector3(dl.x, dl.y + height, dl.z);
    var ur = new Vector3(dr.x, dr.y + height, dr.z);

    boundaries = new Vector3[4];
    boundaries[0] = dr;
    boundaries[1] = dl;
    boundaries[2] = ul;
    boundaries[3] = ur;

    frame = new ComponentFrame(this);
    frame.name = "neo_door_frame";
    frame.material = MaterialManager.Instance.Get("ComponentFrame");
    parentBuilding.parent.AddCombinable(frame.material.name, frame);

    body = new DoorBody(this);
    body.name = "neo_door_body";
    body.material = parentBuilding.parent.doorMaterial;
    parentBuilding.parent.AddCombinable(body.material.name, body);
  }
示例#2
0
        public Door(Face parent, Vector3 dr, Vector3 dl, ComponentCoordinate position)
            : base(parent, position)
        {
            height = parentBuilding.doorHeight;
            depth = 0.4f;

            float mod = 0.4f;
            if (masterParent.doorWidth > 0f)
              mod = (masterParent.doorWidth - (dr - dl).magnitude) / 2f;

            dr += mod * parentFace.right;
            dl -= mod * parentFace.right;

            var ul = new Vector3(dl.x, dl.y + height, dl.z);
            var ur = new Vector3(dr.x, dr.y + height, dr.z);

            boundaries = new Vector3[4];
            boundaries[0] = dr;
            boundaries[1] = dl;
            boundaries[2] = ul;
            boundaries[3] = ur;

            frame = new ComponentFrame(this);
            frame.name = "neo_door_frame";
            frame.material = MaterialManager.Instance.Get("ComponentFrame");
            parentBuilding.parent.AddCombinable(frame.material.name, frame);

            body = new DoorBody(this);
            body.name = "neo_door_body";
            body.material = parentBuilding.parent.doorMaterial;
            parentBuilding.parent.AddCombinable(body.material.name, body);
        }
示例#3
0
  /*************** CONSTRUCTORS ***************/

  public Window (Face parent, Vector3 dr, Vector3 dl, ComponentCoordinate position) 
    : base(parent, position)
  {
    height = parentBuilding.windowHeight;
    depth = 0.4f;
    width = (dr - dl).magnitude;
    float height_modifier = parentBuilding.floorHeight / 2.25f - height / 2;

    if (masterParent.windowWidth > 0f)
    {
      var mod = (masterParent.windowWidth - width) / 2f;
      width = masterParent.windowWidth;
      dr += mod * parentFace.right;
      dl -= mod * parentFace.right;
    }

    boundaries = new Vector3[4];
    boundaries[0] = new Vector3(dr.x, dr.y + height_modifier, dr.z);
    boundaries[1] = new Vector3(dl.x, dl.y + height_modifier, dl.z);
    boundaries[2] = new Vector3(dl.x, dl.y + height + height_modifier, dl.z);
    boundaries[3] = new Vector3(dr.x, dr.y + height + height_modifier, dr.z);

    frame = new ComponentFrame(this);
    frame.name = "neo_window_frame";
    frame.material = MaterialManager.Instance.Get("ComponentFrame");
    parentBuilding.parent.AddCombinable(frame.material.name, frame);

    body = new WindowBody(this);
    body.name = "neo_window_body";
    body.material = parentBuilding.parent.windowMaterial;
    parentBuilding.parent.AddCombinable(body.material.name, body);

    rightShutter = new Shutter(this, ShutterSide.Right);
    rightShutter.name = "right_shutter";
    rightShutter.material = parentBuilding.parent.shutterMaterial;
    parentBuilding.parent.AddCombinable(rightShutter.material.name, rightShutter);

    leftShutter = new Shutter(this, ShutterSide.Left);
    leftShutter.name = "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);
    }
  }