Should have fixed doors
But they are still broken
This commit is contained in:
parent
5a01e45f0c
commit
7029f346e3
4 changed files with 68 additions and 15 deletions
|
@ -169,7 +169,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 2cf81aa4a8d45468f8184f8d5862d7eb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
acceleration: 3
|
||||
acceleration: 4
|
||||
friction: 0.1
|
||||
turnSpeed: 2
|
||||
drift: 1
|
||||
|
|
|
@ -986,6 +986,48 @@ CanvasRenderer:
|
|||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 833134303}
|
||||
--- !u!1001 &865504979
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
|
||||
propertyPath: m_RootOrder
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
--- !u!1 &881384367
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1079,7 +1121,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 5d9a051e822e2cf4ea3ca01c5a4df37c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
followThis: {fileID: 0}
|
||||
followThis: {fileID: 1239288696}
|
||||
--- !u!1 &1001682580
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1328,7 +1370,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!114 &1487324257
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -68,7 +68,7 @@ public class DungeonGenerator {
|
|||
foreach ( GenVertex r1 in Q ) {
|
||||
foreach ( GenVertex r2 in Q ) {
|
||||
if ( r1 == r2 )
|
||||
continue;
|
||||
goto outer;
|
||||
foreach ( GenEdge e in E )
|
||||
if ( e.r2 == r1 && e.r1 == r2 )
|
||||
goto outer;
|
||||
|
@ -149,15 +149,19 @@ public class DungeonGenerator {
|
|||
r.tiles[new Vector2Int(x1, y1)] = Room.TileType.GROUND;
|
||||
}
|
||||
foreach (Vector2Int v in r.AllDoors())
|
||||
{
|
||||
Debug.Log("Door: " + v);
|
||||
if (!r.bounds.Contains(v))
|
||||
throw new NotSupportedException("This is a bug where doors land in the wrong room. It should have been fixed.");
|
||||
else
|
||||
r.tiles[v] = Room.TileType.DOOR;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (GenRoom r in rooms) {
|
||||
generateInterior (r);
|
||||
}
|
||||
|
||||
rooms.Add(path);
|
||||
|
||||
start = root.r;
|
||||
end = null; foreach ( GenRoom r in rooms ) {
|
||||
if ( end == null || r.bounds.x > end.bounds.x )
|
||||
|
@ -218,8 +222,8 @@ public class DungeonGenerator {
|
|||
rooms.Add(tunnel);
|
||||
|
||||
for ( int i = 0; i < TUNNEL_THICKNESS; i++ ) {
|
||||
lower.doorsUp.Add(new Vector2Int(tunnel.bounds.x + i, tunnel.bounds.y + tunnel.bounds.height));
|
||||
higher.doorsDown.Add(new Vector2Int(tunnel.bounds.x + i, tunnel.bounds.y - 1));
|
||||
higher.doorsUp.Add(new Vector2Int(tunnel.bounds.x + i, tunnel.bounds.y + tunnel.bounds.height));
|
||||
lower.doorsDown.Add(new Vector2Int(tunnel.bounds.x + i, tunnel.bounds.y - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,14 +342,14 @@ public class DungeonGenerator {
|
|||
lower.doorsDown.Add(new Vector2Int(verticalLefter.bounds.x + i, verticalLefter.bounds.y - 1));
|
||||
} else
|
||||
for ( int i = 0; i < TUNNEL_THICKNESS; i++ ) {
|
||||
lower.doorsUp.Add(new Vector2Int(verticalLefter.bounds.x + i, verticalLefter.bounds.y + verticalLefter.bounds.height));
|
||||
higher.doorsUp.Add(new Vector2Int(verticalLefter.bounds.x + i, verticalLefter.bounds.y + verticalLefter.bounds.height));
|
||||
}
|
||||
}
|
||||
if ( addVertical2 ) {
|
||||
rooms.Add(verticalRighter);
|
||||
if ( lower == righter )
|
||||
for ( int i = 0; i < TUNNEL_THICKNESS; i++ ) {
|
||||
higher.doorsDown.Add(new Vector2Int(verticalRighter.bounds.x + i, verticalRighter.bounds.y - 1));
|
||||
lower.doorsDown.Add(new Vector2Int(verticalRighter.bounds.x + i, verticalRighter.bounds.y - 1));
|
||||
} else
|
||||
for ( int i = 0; i < TUNNEL_THICKNESS; i++ ) {
|
||||
higher.doorsUp.Add(new Vector2Int(verticalRighter.bounds.x + i, verticalRighter.bounds.y + verticalRighter.bounds.height));
|
||||
|
|
|
@ -21,6 +21,13 @@ public class GenRoom {
|
|||
|
||||
public float Distance(GenRoom r) {
|
||||
return Math.Abs(GetCenter().x - r.GetCenter().x) + Math.Abs(GetCenter().y - r.GetCenter().y);
|
||||
//float power = 2;
|
||||
//float dist = (float) Math.Pow(
|
||||
// Math.Pow(GetCenter().x - r.GetCenter().x, power)
|
||||
// + Math.Pow(GetCenter().y - r.GetCenter().y, power),
|
||||
// 1 / power);
|
||||
//Debug.Log(bounds.center + " " + bounds + " " + dist);
|
||||
//return dist;
|
||||
}
|
||||
|
||||
public Vector2Int GetCenter() {
|
||||
|
|
Loading…
Add table
Reference in a new issue