private void ConstructRoof() { roofBase = new RoofBase(this); if (parent.roofBaseMaterial == null) { var list = MaterialManager.Instance.GetCollection("mat_roof_base"); roofBase.material = list[Random.Range(0, list.Count - 1)]; } else roofBase.material = parent.roofBaseMaterial; parent.AddCombinable(roofBase.material.name, roofBase); int maxcpf = Mathf.Max(faces[0].componentsPerFloor, faces[1].componentsPerFloor); if (parent.roofType == null) { int n = Util.RollDice(new float[] { 0.33f, 0.33f, 0.34f }); if (n == 1) roof = new FlatRoof(this); else if (n == 2 && maxcpf <= 3) roof = new SinglePeakRoof(this); else roof = new DoublePeakRoof(this); } else { var ctors = parent.roofType.GetConstructors(BindingFlags.Instance | BindingFlags.Public); roof = (Roof) ctors[0].Invoke(new object[] { this }); } if (parent.roofMaterial == null) { var list = MaterialManager.Instance.GetCollection("mat_roof"); if (roof.GetType().Equals(typeof(FlatRoof))) roof.material = list[Random.Range(0, 2)]; else roof.material = list[Random.Range(0, list.Count - 1)]; } else roof.material = parent.roofMaterial; parent.AddCombinable(roof.material.name, roof); }
public RoofDecoration(Roof parent) { parentRoof = parent; height = 0.48f; boundaries = new Vector3[8]; if (parentRoof.boundaries.Length < 8) for (int i = 0; i < 4; ++i) { boundaries[i] = parentRoof.boundaries[i]; boundaries[i + 4] = boundaries[i] + height * Vector3.up; } else if (parentRoof.boundaries.Length == 8) for (int i = 0; i < 4; ++i) { boundaries[i] = parentRoof.boundaries[i + 4]; boundaries[i + 4] = boundaries[i] + height * Vector3.up; } }
public RoofDecoration (Roof parent) { parentRoof = parent; height = 0.48f; boundaries = new Vector3[8]; if (parentRoof.boundaries.Length < 8) for (int i = 0; i < 4; ++i) { boundaries[i] = parentRoof.boundaries[i]; boundaries[i + 4] = boundaries[i] + height * Vector3.up; } else if (parentRoof.boundaries.Length == 8) for (int i = 0; i < 4; ++i) { boundaries[i] = parentRoof.boundaries[i + 4]; boundaries[i + 4] = boundaries[i] + height * Vector3.up; } }