コード例 #1
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);
    }
  }
コード例 #2
0
        /*************** 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);
            }
        }
コード例 #3
0
  /*************** 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);
    }
  }