Progress and changes in procedural generation of Dungeon

This commit is contained in:
Jakub Sztuba 2022-12-29 01:53:03 +01:00
parent 1b7825ab20
commit 7f9a7ec9f8
3 changed files with 38 additions and 18 deletions

View File

@ -3680,8 +3680,16 @@ MonoBehaviour:
m_EditorClassIdentifier:
ground: {fileID: 178967048}
walls: {fileID: 1177818049}
ground1: {fileID: 11400000, guid: daff8503ea910584aa0c0bcaea47c1f3, type: 2}
wall1: {fileID: 11400000, guid: 3856c657f18141d448e0f4386818d808, type: 2}
ground1: {fileID: 11400000, guid: bcef03bfe6d889f458c051fcda77d968, type: 2}
wall1: {fileID: 11400000, guid: 94ebdd7e7cf39e841a93596879fe58d5, type: 2}
corner_left_up: {fileID: 11400000, guid: d42493bc02d957348b2fa86903567280, type: 2}
corner_left_down: {fileID: 11400000, guid: de0fda329382efd4282ae71a2102f4d3, type: 2}
corner_right_down: {fileID: 11400000, guid: 358aa35606523e7448ae0830831f6d72, type: 2}
corner_right_up: {fileID: 11400000, guid: deda5f47600755b4483b220e3c1ff87e, type: 2}
left: {fileID: 11400000, guid: 7fd161cc7577108489aca90fb9db6ed1, type: 2}
right: {fileID: 11400000, guid: 2e196d2a440526e4495cf2ae03a1da5c, type: 2}
up: {fileID: 11400000, guid: 5d8974c1ff1a1ee4db297f3cc42015b3, type: 2}
down: {fileID: 11400000, guid: ca1a2a4d015bc0e44b2f7ed4e8a19b0e, type: 2}
--- !u!114 &936884824
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -6,13 +6,14 @@ using GUI_Scripts.ProceduralGeneration;
using UnityEngine;
using UnityEngine.Tilemaps;
using Random = UnityEngine.Random;
using Vector2 = System.Numerics.Vector2;
public class TileMapGenerator : MonoBehaviour
{
// Start is called before the first frame update
public Tilemap ground, walls;
public Tile ground1, wall1;
public Tile ground1, wall1, corner_left_up, corner_left_down, corner_right_down, corner_right_up, left, right, up, down;
public Graph graph;
private void Start()
@ -29,6 +30,7 @@ public class TileMapGenerator : MonoBehaviour
Map map = new Map(new Vector2Int(100, 100));
List<FloodFill> fillers = new List<FloodFill>();
for (int i = 0; i < 70; i++)
{
FloodFill filler = new FloodFill(map, 1, new Vector2Int(Random.Range(0, 70), Random.Range(0, 70)));
@ -85,13 +87,23 @@ public class TileMapGenerator : MonoBehaviour
}
}
}
walls.SetTile(new Vector3Int(-1,-1,0), corner_left_down);
walls.SetTile(new Vector3Int(-1,100,0), corner_left_up);
walls.SetTile(new Vector3Int(100,100,0), corner_right_up);
walls.SetTile(new Vector3Int(100,-1,0), corner_right_down);
for (int i=0; i<100; i++){walls.SetTile(new Vector3Int(-1,i,0), left);}
for (int i=0; i<100; i++){walls.SetTile(new Vector3Int(100,i,0), right);}
for (int i=0; i<100; i++){walls.SetTile(new Vector3Int(i,-1,0), down);}
for (int i=0; i<100; i++){walls.SetTile(new Vector3Int(i,100,0), up);}
GraphNode playerPosStart = graph.graphNodes[Random.Range(0, graph.graphNodes.Count)];
Vector2Int startPos = playerPosStart.positions.ElementAt(Random.Range(0, playerPosStart.positions.Count));
Debug.Log(startPos);
Debug.Log("cell added");
return true;
}

View File

@ -6,35 +6,35 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedScenePath-0:
value: 22424703114646680e0b0227036c72111f19352f223d667d6d1a1226ece42776f7e93ffdfe
flags: 0
RecentlyUsedScenePath-1:
value: 22424703114646680e0b0227036c7c151b12163e2d3a3f7e38271427fb
flags: 0
RecentlyUsedScenePath-2:
RecentlyUsedScenePath-1:
value: 22424703114646680e0b0227036c7c1102161b25212a357e38271427fb
flags: 0
RecentlyUsedScenePath-3:
RecentlyUsedScenePath-2:
value: 22424703114646680e0b0227036c791904040c1c25242a312a2c5326ece92021
flags: 0
RecentlyUsedScenePath-4:
RecentlyUsedScenePath-3:
value: 22424703114646680e0b0227036c70050204112e291f2f2a2c3b1920caef212be7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-5:
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c761e1821112620292135633c133af6f9
flags: 0
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb
flags: 0
RecentlyUsedScenePath-7:
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c68190c160a2e042733232867083debf42d
flags: 0
RecentlyUsedScenePath-8:
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
flags: 0
RecentlyUsedScenePath-9:
RecentlyUsedScenePath-7:
value: 22424703114646680e0b0227036c7c1100123d24383a273e2e2c5326ece92021
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c7b0518101d252266333e243d04
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0