Added new Tileset (Better walls and floors) and reworked layer generation. Working on placeholders next again (Need to fix rotation)
This commit is contained in:
+11
-25
@@ -53,14 +53,12 @@ public class WFC
|
||||
["corner_down_right"] = new() { Direction.Down, Direction.Right },
|
||||
|
||||
["junction"] = new() { Direction.Up, Direction.Down, Direction.Left, Direction.Right },
|
||||
["gate"] = new() { Direction.Up, Direction.Down, Direction.Left, Direction.Right },
|
||||
|
||||
["border"] = new() { }
|
||||
["gate"] = new() { Direction.Up, Direction.Down, Direction.Left, Direction.Right }
|
||||
};
|
||||
|
||||
public static Dictionary<string, float> weights = new()
|
||||
{
|
||||
["junction"] = 5f,
|
||||
["junction"] = 3f,
|
||||
["t_up"] = 3f,
|
||||
["t_down"] = 3f,
|
||||
["t_left"] = 3f,
|
||||
@@ -69,19 +67,17 @@ public class WFC
|
||||
["straight_left_right"] = 2f,
|
||||
["straight_up_down"] = 2f,
|
||||
|
||||
["corner_up_left"] = 0.5f,
|
||||
["corner_up_right"] = 0.5f,
|
||||
["corner_down_left"] = 0.5f,
|
||||
["corner_down_right"] = 0.5f,
|
||||
["corner_up_left"] = 0.7f,
|
||||
["corner_up_right"] = 0.7f,
|
||||
["corner_down_left"] = 0.7f,
|
||||
["corner_down_right"] = 0.7f,
|
||||
|
||||
["end_up"] = 0.2f,
|
||||
["end_down"] = 0.1f,
|
||||
["end_left"] = 0.2f,
|
||||
["end_right"] = 0.3f,
|
||||
|
||||
["gate"] = 0.1f,
|
||||
|
||||
["border"] = 0.0f
|
||||
["gate"] = 0.1f
|
||||
};
|
||||
|
||||
public static Direction Opposite(Direction dir)
|
||||
@@ -169,7 +165,7 @@ public class WFC
|
||||
{
|
||||
var next = position + offsets[i];
|
||||
|
||||
if (!InBounds(next, layer.GetLength(0), false))
|
||||
if (!InBounds(next, layer.GetLength(0)))
|
||||
continue;
|
||||
|
||||
if (CanWalk(layer, position, next, dirs[i]))
|
||||
@@ -189,21 +185,11 @@ public class WFC
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool InBounds(Vector2I pos, int layerSize, bool includeBorder = true)
|
||||
public static bool InBounds(Vector2I pos, int layerSize)
|
||||
{
|
||||
if (includeBorder)
|
||||
{
|
||||
return pos.X >= 0 &&
|
||||
pos.Y >= 0 &&
|
||||
return pos.X > 0 &&
|
||||
pos.Y > 0 &&
|
||||
pos.X < layerSize &&
|
||||
pos.Y < layerSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
return pos.X > 0 &&
|
||||
pos.Y > 0 &&
|
||||
pos.X < layerSize - 1 &&
|
||||
pos.Y < layerSize - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user