Přidány základy generování mapy (zatím pouze server-side, bez zrcadlení do clienta)
This commit is contained in:
parent
8a3267cc4b
commit
8801a7c919
6 changed files with 100 additions and 1 deletions
25
FNAF_Server/Map/MapTile.cs
Normal file
25
FNAF_Server/Map/MapTile.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
namespace FNAF_Server.Map;
|
||||
|
||||
public class MapTile {
|
||||
public int Id { get; private set; }
|
||||
public ServerPlayer Owner { get; private set; }
|
||||
public bool Lit { get; set; } = false;
|
||||
|
||||
private List<TileConnector> Connectors { get; set; } = new();
|
||||
|
||||
public MapTile(int id, ServerPlayer owner) {
|
||||
Id = id;
|
||||
Owner = owner;
|
||||
}
|
||||
public void AddConnector(MapTile tile, TileConnector.ConnectorType type, int value) {
|
||||
Connectors.Add(new TileConnector(this, tile, type, value));
|
||||
tile.Connectors.Add(new TileConnector(tile, this, type, value));
|
||||
}
|
||||
|
||||
public void AddConnectors((MapTile tile, TileConnector.ConnectorType type, int value)[] connectors) =>
|
||||
Array.ForEach(connectors, c => AddConnector(c.tile, c.type, c.value));
|
||||
|
||||
public override string ToString() => $"{PositionAsString} -> {string.Join(", ", Connectors.Select(c => c.Tiles.Item2.PositionAsString))}";
|
||||
public string PositionAsString => $"[{Id / 5}, {Id % 5}]"; // for debug purposes
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue