-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFullHouse.cs
147 lines (129 loc) · 3.4 KB
/
FullHouse.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
using ProBuilder.Core;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// A fully equipped customizable house.
/// </summary>
[System.Serializable]
public class FullHouse : CustomizableHouse
{
#region SerializableFields
/// <summary>
/// Contains all of the dimensions.
/// </summary>
public Dimensions dimensions = new Dimensions();
/// <summary>
/// Contains all of the textures.
/// </summary>
public Textures textures = new Textures();
/// <summary>
/// Contains all of the outer details.
/// </summary>
public OuterDetails outerDetails = new OuterDetails();
/// <summary>
/// Contains all of the inner details.
/// </summary>
public InnerDetails innerDetails = new InnerDetails();
/// <summary>
/// All of the house extensions.
/// </summary>
public List<HouseExtension> extensions = new List<HouseExtension>();
/// <summary>
/// Contains all of the advanced settings.
/// </summary>
public AdvancedOptions advancedOptions = new AdvancedOptions();
public override Dimensions Dim
{
get { return dimensions; }
set { dimensions = value; }
}
public override Textures Tex
{
get { return textures; }
set { textures = value; }
}
public override OuterDetails OD
{
get { return outerDetails; }
set { outerDetails = value; }
}
public override InnerDetails ID
{
get { return innerDetails; }
set { innerDetails = value; }
}
public override List<HouseExtension> EX
{
get { return extensions; }
set { extensions = value; }
}
public override AdvancedOptions AO
{
get { return advancedOptions; }
set { advancedOptions = value; }
}
#endregion
/// <summary>
/// Adds the cutouts for the extensions.
/// </summary>
protected override void AddExtensionCutouts(int i, ref List<pb_Object> cutouts, List<PBUtility.Cutout> cuts, Transform wall, float wallLength)
{
foreach (HouseExtension e in EX)
{
if ((int)e.wall == i)
{
int reverse;
switch (i)
{
case 3:
reverse = -1;
break;
case 2:
reverse = 1;
break;
case 1:
reverse = -1;
break;
case 0:
default:
reverse = 1;
break;
}
pb_Object cutout = pb_ShapeGenerator.CubeGenerator(new Vector3(e.extent.WallLength(e.wall) - ((AO.foundationSeparation + AO.wallThickness)* 2f),
Mathf.Min(e.extent.Dim.height, Dim.height) - AO.ceilingThickness, AO.wallThickness + NUDGE));
cutout.transform.SetParent(transform);
cutout.transform.localPosition = new Vector3((WallLength(e.wall) + e.extent.WallLength(e.wall) - (AO.foundationSeparation * 4f)) * e.position / 2f * reverse,
(Mathf.Min(e.extent.Dim.height, Dim.height) - (AO.ceilingThickness + Dim.height)) / 2f, 0);
cutouts.Add(cutout);
cuts.Add(new PBUtility.Cutout(cutout));
}
}
}
/// <summary>
/// Creates the extensions.
/// </summary>
protected override void CreateExtensions()
{
SetUpExtensions();
foreach (HouseExtension e in EX)
{
SetUpExtension(e);
e.extent.GenerateHouse();
}
}
/// <summary>
/// Remakes the extensions for component generation.
/// </summary>
protected override void RemakeExtensions()
{
if (extensionsObj == null)
{
SetUpExtensions();
foreach (HouseExtension e in EX)
{
SetUpExtension(e);
}
}
}
}