Oprava spawnování monster, optimalizace v CommandProcessor a EventProcessor. Přesunutí některých tříd do vlastních namespaců, pročištění kódu, úpravy formátování, odstranění nepoužívaných souborů a zakomentovaného kódu
This commit is contained in:
parent
e5d746d597
commit
243f071a43
62 changed files with 873 additions and 1217 deletions
|
|
@ -1,27 +1,22 @@
|
|||
namespace GlobalClassLib;
|
||||
|
||||
public abstract class GlobalMapTile<TCon, TTile> where TCon : GlobalTileConnector<TTile, TCon> where TTile : GlobalMapTile<TCon, TTile> { // TTile should be the inheriting class
|
||||
public int Id { get; }
|
||||
public abstract class GlobalMapTile<TCon, TTile>(int id, (int x, int y) gridPosition)
|
||||
where TCon : GlobalTileConnector<TTile, TCon>
|
||||
where TTile : GlobalMapTile<TCon, TTile> { // TTile should be the inheriting class
|
||||
public int Id { get; } = id;
|
||||
public bool Lit { get; set; } = false;
|
||||
public (int x, int y) GridPosition { get; private set; }
|
||||
public (int x, int y) GridPosition { get; private set; } = gridPosition;
|
||||
|
||||
private readonly List<TCon> connectors = new();
|
||||
|
||||
private List<TCon> connectors = new();
|
||||
|
||||
public GlobalMapTile(int id, (int x, int y) gridPosition) {
|
||||
Id = id;
|
||||
GridPosition = gridPosition;
|
||||
}
|
||||
public void AddConnector(TCon connector) { // tile1 is ignored when provided
|
||||
connector = connector.Clone();
|
||||
connector.Tiles.tile1 = (TTile)this;
|
||||
connectors.Add(connector);
|
||||
connector.Tiles.tile2._AddConnectorNoRepeat(connector);
|
||||
// connectors.Add(new TCon(this, tile, type));
|
||||
// tile.connectors.Add(new GlobalTileConnector(tile, this, type));
|
||||
}
|
||||
|
||||
private void _AddConnectorNoRepeat(TCon connector) {
|
||||
// (connector.Tiles.tile1, connector.Tiles.tile2) = (connector.Tiles.tile2, connector.Tiles.tile1);
|
||||
connectors.Add(connector);
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +25,7 @@ public abstract class GlobalMapTile<TCon, TTile> where TCon : GlobalTileConnecto
|
|||
|
||||
public override string ToString() => $"[{Id}] -> {string.Join(", ", connectors.Select(c => $"[{c.OtherTile((TTile)this).Id}]"))}";
|
||||
public override int GetHashCode() => Id.GetHashCode();
|
||||
public string PositionAsString => $"[{Id}]"; // for debug purposes
|
||||
public string IdAsString => $"[{Id}]"; // debug
|
||||
|
||||
public TCon? GetConnector(int id) {
|
||||
foreach (var con in connectors){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue