Spawnpoint
This commit is contained in:
parent
0ed78a8bce
commit
6118a32fc6
2 changed files with 12 additions and 5 deletions
|
@ -402,7 +402,6 @@ public class DungeonGenerator {
|
|||
}
|
||||
|
||||
public void GenerateInterior(GenRoom r) {
|
||||
|
||||
Vector2Int root = new Vector2Int (1, 1);
|
||||
|
||||
for (int x = r.bounds.x; x < r.bounds.x + r.bounds.width; x++)
|
||||
|
@ -413,10 +412,6 @@ public class DungeonGenerator {
|
|||
if (!r.tiles.ContainsKey(pos) || r.tiles[pos].type != Room.TileType.GROUND)
|
||||
continue;
|
||||
float prob = 0.0075f;
|
||||
if (UnityEngine.Random.value > 1 - prob)
|
||||
{
|
||||
r.tiles[pos].type = Room.TileType.ROCK;
|
||||
}
|
||||
if (UnityEngine.Random.value > 1 - prob * 2)
|
||||
{
|
||||
int count = (int ) (UnityEngine.Random.value * UnityEngine.Random.value * 6);
|
||||
|
@ -427,7 +422,18 @@ public class DungeonGenerator {
|
|||
if (r.tiles.ContainsKey(pos2) && r.tiles[pos2].type == Room.TileType.GROUND)
|
||||
r.tiles[pos2].type = Room.TileType.ROCK;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (UnityEngine.Random.value > 1 - prob)
|
||||
{
|
||||
r.tiles[pos].type = Room.TileType.ROCK;
|
||||
continue;
|
||||
}
|
||||
float prob2 = 0.02f;
|
||||
if (UnityEngine.Random.value > 1 - prob2)
|
||||
{
|
||||
r.spawnpoints.Add(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public class GenRoom {
|
|||
public Vector2Int roomPosition;
|
||||
// All positions are in room space relative to the room's anchor
|
||||
public Dictionary<Vector2Int, GenTile> tiles = new Dictionary<Vector2Int, GenTile>();
|
||||
public HashSet<Vector2Int> spawnpoints = new HashSet<Vector2Int>();
|
||||
|
||||
public float Distance(GenRoom r) {
|
||||
return Math.Abs(GetCenter().x - r.GetCenter().x) + Math.Abs(GetCenter().y - r.GetCenter().y);
|
||||
|
|
Loading…
Add table
Reference in a new issue