Implemented randomly dispersing monster rooms.

This commit is contained in:
Max 2025-02-03 17:46:12 +01:00
parent 5895a9f878
commit 9c02b11299
12 changed files with 394 additions and 0 deletions

View file

@ -0,0 +1,25 @@
using System;
namespace DungeonGenerator
{
public struct Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y) {
X = x;
Y = y;
}
public override bool Equals(object obj) => obj is Point p && X == p.X && Y == p.Y;
public override int GetHashCode() => HashCode.Combine(X, Y);
public override string ToString() => $"({X}, {Y})";
public static Point operator +(Point a, Point b) => new Point(a.X + b.X, a.Y + b.Y);
public static Point operator -(Point a, Point b) => new Point(a.X - b.X, a.Y - b.Y);
public int ManhattanDistance(Point other) => Math.Abs(X - other.X) + Math.Abs(Y - other.Y);
}
}