Skip to content
This repository was archived by the owner on Mar 16, 2023. It is now read-only.

Commit e9c418e

Browse files
committed
Rewrite started
1 parent 9fd07ad commit e9c418e

File tree

8 files changed

+530
-19
lines changed

8 files changed

+530
-19
lines changed

Assets/Scripts/Generation/POI/BuildingGenerator.cs

Lines changed: 484 additions & 0 deletions
Large diffs are not rendered by default.

Assets/Scripts/Generation/POI/BuildingGenerator.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/Generation/POI/LSystem.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ public bool SquareFromPoint(int[] perimeterBounds, Int2 originPoint, int[] paren
189189

190190
bool GenerateRect(int index, Int2 originPoint, Zone.Side originSide, int[] perimeterBounds, bool adjacentOverride, int minWidth, int maxWidth, int minLength, int maxLength)
191191
{
192-
Vector3 global = MatrixToGlobal(originPoint);
193192
ResetNoise();
194193
// Rotate script values to face the same way as this square
195194
Rotate(originSide);

Assets/Scripts/Generation/POI/POILibrary.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ public class POI
1010
{
1111
public int wallHeight = 5;
1212

13-
public void GenerateMatrixes(LSystem lSystem, Zone zone)
13+
public void GenerateMatrixes(BuildingGenerator buildingGenerator, Zone zone)
1414
{
15-
lSystem.GenerateBuilding();
15+
buildingGenerator.Generate();
1616

17-
lSystem.DefineArea();
18-
19-
lSystem.ApplyMaps(this);
17+
buildingGenerator.ApplyMaps(this);
2018
}
2119

2220

Assets/Scripts/Generation/POI/PointOfInterest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public PointOfInterest(Column initialColumn, World world)
5858
ProcessZone(zones[0]);
5959

6060
// System for creating random building arrangements
61-
LSystem lSystem = new LSystem(zones[0]);
61+
BuildingGenerator building = new BuildingGenerator(zones[0]);
6262
// Generate building from POI library
63-
TerrainGenerator.worldBiomes.POIs.GenerateMatrixes(lSystem, zones[0]);
63+
TerrainGenerator.worldBiomes.POIs.GenerateMatrixes(building, zones[0]);
6464

6565
// Generate column topologies
6666
foreach(Column column in allCreated)

Assets/Scripts/Util.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,25 @@ public static double RoundToDP(float value, int decimalPlaces)
154154
return System.Math.Round(value, decimalPlaces);
155155
}
156156

157+
public static int Wrap0(int value, int max)
158+
{
159+
if(value > max)
160+
{
161+
while(value > max)
162+
{
163+
value -= (max + 1);
164+
}
165+
}
166+
else if(value < 0)
167+
{
168+
while(value < 0)
169+
{
170+
value += (max + 1);
171+
}
172+
}
173+
return 0 + value;
174+
}
175+
157176
public static int MinInt(int[] values)
158177
{
159178
int min = values[0];

Assets/world.unity

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ RectTransform:
195195
m_AnchorMin: {x: 0, y: 1}
196196
m_AnchorMax: {x: 0, y: 1}
197197
m_AnchoredPosition: {x: 0, y: 0}
198-
m_SizeDelta: {x: 97, y: 73}
198+
m_SizeDelta: {x: 0, y: 0}
199199
m_Pivot: {x: 0, y: 1}
200200
--- !u!114 &322219937
201201
MonoBehaviour:
@@ -344,7 +344,7 @@ Transform:
344344
m_CorrespondingSourceObject: {fileID: 0}
345345
m_PrefabInternal: {fileID: 0}
346346
m_GameObject: {fileID: 361190250}
347-
m_LocalRotation: {x: 0.5867261, y: 0, z: 0, w: 0.8097854}
347+
m_LocalRotation: {x: 0.70494425, y: 0, z: 0, w: 0.7092627}
348348
m_LocalPosition: {x: 0, y: 0, z: 0}
349349
m_LocalScale: {x: 1, y: 1, z: 1}
350350
m_Children: []
@@ -906,8 +906,8 @@ Transform:
906906
m_CorrespondingSourceObject: {fileID: 0}
907907
m_PrefabInternal: {fileID: 0}
908908
m_GameObject: {fileID: 1504611311}
909-
m_LocalRotation: {x: 0, y: -0.71233284, z: 0, w: -0.7018419}
910-
m_LocalPosition: {x: 380.3714, y: 77.733925, z: -1849.2798}
909+
m_LocalRotation: {x: 0, y: 0.0047991346, z: 0, w: -0.9999885}
910+
m_LocalPosition: {x: 421.5044, y: 131.04825, z: -1856.6865}
911911
m_LocalScale: {x: 1, y: 1, z: 1}
912912
m_Children:
913913
- {fileID: 361190254}
@@ -1146,22 +1146,22 @@ Prefab:
11461146
- target: {fileID: 224583794789008462, guid: 9832b69a4694a734b898db15e38408e8,
11471147
type: 2}
11481148
propertyPath: m_AnchoredPosition.x
1149-
value: 48.5
1149+
value: 0
11501150
objectReference: {fileID: 0}
11511151
- target: {fileID: 224583794789008462, guid: 9832b69a4694a734b898db15e38408e8,
11521152
type: 2}
11531153
propertyPath: m_AnchoredPosition.y
1154-
value: -36.5
1154+
value: 0
11551155
objectReference: {fileID: 0}
11561156
- target: {fileID: 224583794789008462, guid: 9832b69a4694a734b898db15e38408e8,
11571157
type: 2}
11581158
propertyPath: m_SizeDelta.x
1159-
value: 77
1159+
value: 0
11601160
objectReference: {fileID: 0}
11611161
- target: {fileID: 224583794789008462, guid: 9832b69a4694a734b898db15e38408e8,
11621162
type: 2}
11631163
propertyPath: m_SizeDelta.y
1164-
value: 53
1164+
value: 0
11651165
objectReference: {fileID: 0}
11661166
- target: {fileID: 224583794789008462, guid: 9832b69a4694a734b898db15e38408e8,
11671167
type: 2}
@@ -1171,7 +1171,7 @@ Prefab:
11711171
- target: {fileID: 224583794789008462, guid: 9832b69a4694a734b898db15e38408e8,
11721172
type: 2}
11731173
propertyPath: m_AnchorMin.y
1174-
value: 1
1174+
value: 0
11751175
objectReference: {fileID: 0}
11761176
- target: {fileID: 224583794789008462, guid: 9832b69a4694a734b898db15e38408e8,
11771177
type: 2}
@@ -1181,7 +1181,7 @@ Prefab:
11811181
- target: {fileID: 224583794789008462, guid: 9832b69a4694a734b898db15e38408e8,
11821182
type: 2}
11831183
propertyPath: m_AnchorMax.y
1184-
value: 1
1184+
value: 0
11851185
objectReference: {fileID: 0}
11861186
- target: {fileID: 224583794789008462, guid: 9832b69a4694a734b898db15e38408e8,
11871187
type: 2}

ProjectSettings/ProjectVersion.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
m_EditorVersion: 2018.2.8f1
1+
m_EditorVersion: 2018.2.9f1

0 commit comments

Comments
 (0)