1
0
Fork 0

First try at ParticleSystem for car | Tile render layer set to object

This commit is contained in:
Saibotk 2018-04-22 20:31:00 +02:00
parent 5a5ce57c10
commit 2b2bcbb7ed
25 changed files with 4746 additions and 114 deletions

File diff suppressed because it is too large Load diff

View file

@ -137,8 +137,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 1310459315
m_SortingLayer: 0 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 6e7545b35610da243b692db13fb3c380, type: 3} m_Sprite: {fileID: 21300000, guid: 6e7545b35610da243b692db13fb3c380, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -72,8 +72,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 1778783263
m_SortingLayer: 0 m_SortingLayer: -2
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 79d2e82f1d7398f41aa2dd6501e9d21c, type: 3} m_Sprite: {fileID: 21300000, guid: 79d2e82f1d7398f41aa2dd6501e9d21c, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 1 m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: 501cd953a03a59f4aa2fd59e8b36f811, type: 3} m_Sprite: {fileID: 21300000, guid: 501cd953a03a59f4aa2fd59e8b36f811, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 82051033f41334d428de695a5a8e7c12, type: 3} m_Sprite: {fileID: 21300000, guid: 82051033f41334d428de695a5a8e7c12, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: c475ca15f80477e408ff4a4307e97c1e, type: 3} m_Sprite: {fileID: 21300000, guid: c475ca15f80477e408ff4a4307e97c1e, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 238a9e0dfc53f5e4ab2d01e57520b72a, type: 3} m_Sprite: {fileID: 21300000, guid: 238a9e0dfc53f5e4ab2d01e57520b72a, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 106ee2c5b569c9a4489a53f7c09ec01d, type: 3} m_Sprite: {fileID: 21300000, guid: 106ee2c5b569c9a4489a53f7c09ec01d, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 4400c4135c42bba4a8cdc614dee7cc71, type: 3} m_Sprite: {fileID: 21300000, guid: 4400c4135c42bba4a8cdc614dee7cc71, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 57f730fb313fa4f4a9a6bff7b5b6d989, type: 3} m_Sprite: {fileID: 21300000, guid: 57f730fb313fa4f4a9a6bff7b5b6d989, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 41944bee4ca9a194a9c9445a9e6e3a0c, type: 3} m_Sprite: {fileID: 21300000, guid: 41944bee4ca9a194a9c9445a9e6e3a0c, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 2e92ac748c8ec9c48bc704174cbda95a, type: 3} m_Sprite: {fileID: 21300000, guid: 2e92ac748c8ec9c48bc704174cbda95a, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 47b3779112f32c24baa11de4d6d5c845, type: 3} m_Sprite: {fileID: 21300000, guid: 47b3779112f32c24baa11de4d6d5c845, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 35f28a36eba6ad044bea0c72a00d97fc, type: 3} m_Sprite: {fileID: 21300000, guid: 35f28a36eba6ad044bea0c72a00d97fc, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 63d16c78755cba745921718c743a2116, type: 3} m_Sprite: {fileID: 21300000, guid: 63d16c78755cba745921718c743a2116, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 8ef67ce279976d44a9338fb41a62e7d6, type: 3} m_Sprite: {fileID: 21300000, guid: 8ef67ce279976d44a9338fb41a62e7d6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: ef89da04d3747bb48a064d87501b6d01, type: 3} m_Sprite: {fileID: 21300000, guid: ef89da04d3747bb48a064d87501b6d01, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 8f27887e9aa83824895057a4385066db, type: 3} m_Sprite: {fileID: 21300000, guid: 8f27887e9aa83824895057a4385066db, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1688722395 m_SortingLayerID: 1310459315
m_SortingLayer: 1 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 0dc1a020a0b54c844a7e774f68714d24, type: 3} m_Sprite: {fileID: 21300000, guid: 0dc1a020a0b54c844a7e774f68714d24, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 1310459315
m_SortingLayer: 0 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 27158993fe3e5214bb8a679006e843ff, type: 3} m_Sprite: {fileID: 21300000, guid: 27158993fe3e5214bb8a679006e843ff, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 1310459315
m_SortingLayer: 0 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 84ba95c2bc5775849a0e2ea9b11724c2, type: 3} m_Sprite: {fileID: 21300000, guid: 84ba95c2bc5775849a0e2ea9b11724c2, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -98,8 +98,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 1310459315
m_SortingLayer: 0 m_SortingLayer: -1
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: f659418abd9d52a458ccd5747ff550f6, type: 3} m_Sprite: {fileID: 21300000, guid: f659418abd9d52a458ccd5747ff550f6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -1025,6 +1025,10 @@ Prefab:
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 4 value: 4
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
@ -1121,7 +1125,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5d9a051e822e2cf4ea3ca01c5a4df37c, type: 3} m_Script: {fileID: 11500000, guid: 5d9a051e822e2cf4ea3ca01c5a4df37c, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
followThis: {fileID: 1239288696} followThis: {fileID: 0}
--- !u!1 &1001682580 --- !u!1 &1001682580
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1370,7 +1374,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!114 &1487324257 --- !u!114 &1487324257
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1382,6 +1386,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f52f2b666c1ec64195aad9936df2d4f, type: 3} m_Script: {fileID: 11500000, guid: 4f52f2b666c1ec64195aad9936df2d4f, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
notifications: {fileID: 0}
gameOverPanel: {fileID: 354516592} gameOverPanel: {fileID: 354516592}
healthcontroller: {fileID: 623293249} healthcontroller: {fileID: 623293249}
--- !u!4 &1487324258 --- !u!4 &1487324258
@ -1629,8 +1634,8 @@ MonoBehaviour:
RockLUR: {fileID: 1938166751346222, guid: 6b83a6a46c57a634fa5085684bad0085, type: 2} RockLUR: {fileID: 1938166751346222, guid: 6b83a6a46c57a634fa5085684bad0085, type: 2}
RockURD: {fileID: 1437035058628240, guid: 30338afac8ce7054fbff8de89db815e8, type: 2} RockURD: {fileID: 1437035058628240, guid: 30338afac8ce7054fbff8de89db815e8, type: 2}
RockLRD: {fileID: 1251219893662246, guid: e37e0c5d4b013304cbcb32b223264452, type: 2} RockLRD: {fileID: 1251219893662246, guid: e37e0c5d4b013304cbcb32b223264452, type: 2}
ui: {fileID: 1487324256}
cam: {fileID: 881384367}
playerPrefab: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f, playerPrefab: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f,
type: 2} type: 2}
ui: {fileID: 1487324256}
cam: {fileID: 881384367}
mapRoot: {fileID: 1624368723} mapRoot: {fileID: 1624368723}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d819f21fefea9da4199b468cca99e711
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -15,10 +15,10 @@ public class DungeonGenerator {
// The room containing all the paths connecting normal rooms // The room containing all the paths connecting normal rooms
public GenRoom path; public GenRoom path;
// All rooms except the three above // All rooms except the three above
public HashSet<GenRoom> rooms; public HashSet<GenRoom> rooms;
private const float percentageRocks = 0.03f; private const float percentageRocks = 0.03f;
private const int maxRockCluster = 5; private const int maxRockCluster = 5;
public void Generate() { public void Generate() {
int minRoomSize = 50; int minRoomSize = 50;
@ -31,7 +31,7 @@ public class DungeonGenerator {
} }
while ( true ) { while ( true ) {
bool changed = false; bool changed = false;
foreach ( GenRoom r1 in rooms ) { foreach ( GenRoom r1 in rooms ) {
foreach ( GenRoom r2 in rooms ) { foreach ( GenRoom r2 in rooms ) {
if ( r1 == r2 ) if ( r1 == r2 )
@ -41,14 +41,14 @@ public class DungeonGenerator {
if ( Math.Pow(Vector2Int.Distance(p1, p2), 2) < 2 * minRoomSize * minRoomSize + 2 ) { if ( Math.Pow(Vector2Int.Distance(p1, p2), 2) < 2 * minRoomSize * minRoomSize + 2 ) {
r2.bounds.x += ( int ) ( ( UnityEngine.Random.value - 0.5 ) * 5 ); r2.bounds.x += ( int ) ( ( UnityEngine.Random.value - 0.5 ) * 5 );
r2.bounds.y += ( int ) ( ( UnityEngine.Random.value - 0.5 ) * 2.5 ); r2.bounds.y += ( int ) ( ( UnityEngine.Random.value - 0.5 ) * 2.5 );
changed = true; changed = true;
break; break;
} }
} }
if (changed) if ( changed )
break; break;
} }
if (!changed) if ( !changed )
break; break;
} }
@ -73,7 +73,7 @@ public class DungeonGenerator {
if ( e.r2 == r1 && e.r1 == r2 ) if ( e.r2 == r1 && e.r1 == r2 )
goto outer; goto outer;
E.Add(new GenEdge(r1, r2)); E.Add(new GenEdge(r1, r2));
} }
outer:; outer:;
} }
F.Add(root); F.Add(root);
@ -127,40 +127,39 @@ public class DungeonGenerator {
foreach ( GenRoom r in rooms2 ) { foreach ( GenRoom r in rooms2 ) {
for ( int x1 = r.bounds.x; x1 < r.bounds.x + r.bounds.width; x1++ ) for ( int x1 = r.bounds.x; x1 < r.bounds.x + r.bounds.width; x1++ )
for ( int y1 = r.bounds.y; y1 < r.bounds.y + r.bounds.height; y1++ ) { for ( int y1 = r.bounds.y; y1 < r.bounds.y + r.bounds.height; y1++ ) {
Vector2Int pos1 = new Vector2Int(x1, y1); Vector2Int pos1 = new Vector2Int(x1, y1);
if (path.tiles.ContainsKey(pos1)) if ( path.tiles.ContainsKey(pos1) )
path.tiles[pos1] = Room.TileType.GROUND; path.tiles[pos1] = Room.TileType.GROUND;
else else
path.tiles.Add(pos1, Room.TileType.GROUND); path.tiles.Add(pos1, Room.TileType.GROUND);
for ( int x2 = x1 - 1; x2 <= x1 + 1; x2++ ) for ( int x2 = x1 - 1; x2 <= x1 + 1; x2++ )
for ( int y2 = y1 - 1; y2 <= y1 + 1; y2++ ) { for ( int y2 = y1 - 1; y2 <= y1 + 1; y2++ ) {
if (!path.tiles.ContainsKey(new Vector2Int(x2, y2))) if ( !path.tiles.ContainsKey(new Vector2Int(x2, y2)) )
path.tiles.Add(new Vector2Int(x2, y2), Room.TileType.WALL); path.tiles.Add(new Vector2Int(x2, y2), Room.TileType.WALL);
} }
} }
} }
foreach ( GenRoom r in rooms ) { foreach ( GenRoom r in rooms ) {
for ( int x1 = r.bounds.x; x1 < r.bounds.x + r.bounds.width; x1++ ) for ( int x1 = r.bounds.x; x1 < r.bounds.x + r.bounds.width; x1++ )
for ( int y1 = r.bounds.y; y1 < r.bounds.y + r.bounds.height; y1++ ) { for ( int y1 = r.bounds.y; y1 < r.bounds.y + r.bounds.height; y1++ ) {
r.tiles.Add(new Vector2Int(x1, y1), Room.TileType.WALL); r.tiles.Add(new Vector2Int(x1, y1), Room.TileType.WALL);
} }
for ( int x1 = r.bounds.x + 1; x1 < r.bounds.x + r.bounds.width - 1; x1++ ) for ( int x1 = r.bounds.x + 1; x1 < r.bounds.x + r.bounds.width - 1; x1++ )
for ( int y1 = r.bounds.y + 1; y1 < r.bounds.y + r.bounds.height - 1; y1++ ) { for ( int y1 = r.bounds.y + 1; y1 < r.bounds.y + r.bounds.height - 1; y1++ ) {
r.tiles[new Vector2Int(x1, y1)] = Room.TileType.GROUND; r.tiles[new Vector2Int(x1, y1)] = Room.TileType.GROUND;
} }
foreach (Vector2Int v in r.AllDoors()) foreach ( Vector2Int v in r.AllDoors() ) {
{ Debug.Log("Door: " + v);
Debug.Log("Door: " + v); if ( !r.bounds.Contains(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.");
throw new NotSupportedException("This is a bug where doors land in the wrong room. It should have been fixed."); else
else r.tiles[v] = Room.TileType.DOOR;
r.tiles[v] = Room.TileType.DOOR; }
}
} }
foreach (GenRoom r in rooms) { foreach ( GenRoom r in rooms ) {
generateInterior (r); generateInterior(r);
} }
start = root.r; start = root.r;
end = null; foreach ( GenRoom r in rooms ) { end = null; foreach ( GenRoom r in rooms ) {
@ -168,22 +167,22 @@ public class DungeonGenerator {
end = r; end = r;
} }
rooms.Remove(start); rooms.Remove(start);
rooms.Remove(end); rooms.Remove(end);
foreach (GenRoom r in rooms) foreach ( GenRoom r in rooms )
makeRoomRelative(r); makeRoomRelative(r);
makeRoomRelative(start); makeRoomRelative(start);
makeRoomRelative(end); makeRoomRelative(end);
makeRoomRelative(path); makeRoomRelative(path);
} }
public void makeRoomRelative(GenRoom room) { public void makeRoomRelative(GenRoom room) {
room.roomPosition = room.bounds.position; room.roomPosition = room.bounds.position;
foreach (Vector2Int v in room.tiles.Keys) { foreach ( Vector2Int v in room.tiles.Keys ) {
v.Set((v - room.roomPosition).x, (v-room.roomPosition).y); v.Set(( v - room.roomPosition ).x, ( v - room.roomPosition ).y);
} }
} }
public static void AddStraightHorizontal(HashSet<GenRoom> rooms, GenEdge ed) { public static void AddStraightHorizontal(HashSet<GenRoom> rooms, GenEdge ed) {
GenRoom righter = ed.r1.r.GetCenter().x > ed.r2.r.GetCenter().x ? ed.r1.r : ed.r2.r; GenRoom righter = ed.r1.r.GetCenter().x > ed.r2.r.GetCenter().x ? ed.r1.r : ed.r2.r;
@ -357,32 +356,31 @@ public class DungeonGenerator {
} }
} }
public static void generateInterior(GenRoom r) public static void generateInterior(GenRoom r) {
{ //int width = r.bounds.width;
//int width = r.bounds.width; //int height = r.bounds.height;
//int height = r.bounds.height;
//Vector2Int root = new Vector2Int (1, 1); //Vector2Int root = new Vector2Int (1, 1);
//Random rand = new Random (System.DateTime.Now); //Random rand = new Random (System.DateTime.Now);
//for(int x = 0; i != width; ++x) //for(int x = 0; i != width; ++x)
//{ //{
// for(int y = 0; y != width; ++y) // for(int y = 0; y != width; ++y)
// { // {
// Room.TileType tempTile; // Room.TileType tempTile;
// r.tiles.TryGetValue (root + new Vector2Int (x, y), tempTile); // r.tiles.TryGetValue (root + new Vector2Int (x, y), tempTile);
// if(rand.NextDouble() <= percentageRocks && tempTile.Equals(Room.TileType.GROUND) // if(rand.NextDouble() <= percentageRocks && tempTile.Equals(Room.TileType.GROUND)
// { // {
// int clusterSize = rand.Next (1, maxRockCluster + 1); // int clusterSize = rand.Next (1, maxRockCluster + 1);
// r.tiles.Add (root + new Vector2Int (x, y), Room.TileType.ROCK); // r.tiles.Add (root + new Vector2Int (x, y), Room.TileType.ROCK);
// for(int i = 0; i != clusterSize; ++i) // for(int i = 0; i != clusterSize; ++i)
// { // {
// Vector2Int newRock = root + new Vector2Int(x + rand.Next(0, 2), y + rand.Next(0, 2)); // Vector2Int newRock = root + new Vector2Int(x + rand.Next(0, 2), y + rand.Next(0, 2));
// r.tiles.TryGetValue (newRock, tempTile); // r.tiles.TryGetValue (newRock, tempTile);
// if(!tempTile.Equals(Room.TileType.GROUND)) // if(!tempTile.Equals(Room.TileType.GROUND))
// break; // break;
@ -390,5 +388,5 @@ public class DungeonGenerator {
} }
} }