První 3 monstra z plánovaných pěti. Kompletní pathfinding i zrcadlení do clienta. Útoky implementované nejsou. Lurk a Neko jsou hardcoded aby útočili na P1.
This commit is contained in:
parent
4484b127c5
commit
9bfe63a166
27 changed files with 772 additions and 47 deletions
|
|
@ -1,7 +1,7 @@
|
|||
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; private set; }
|
||||
public int Id { get; }
|
||||
public bool Lit { get; set; } = false;
|
||||
public (int x, int y) GridPosition { get; private set; }
|
||||
|
||||
|
|
@ -28,17 +28,22 @@ public abstract class GlobalMapTile<TCon, TTile> where TCon : GlobalTileConnecto
|
|||
public void AddConnectors(TCon[] connectors) =>
|
||||
Array.ForEach(connectors, AddConnector);
|
||||
|
||||
public override string ToString() => $"{PositionAsString} -> {string.Join(", ", connectors.Select(c => c.Tiles.Item2.PositionAsString))}";
|
||||
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 TCon? GetConnector(int id) {
|
||||
foreach (var con in connectors){
|
||||
if (con.Tiles.Item2.Id == id) return con;
|
||||
if (con.OtherTile((TTile)this).Id == id) return con;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public TCon? GetConnector(TTile tile) {
|
||||
foreach (var con in connectors){
|
||||
if (con.OtherTile((TTile)this) == tile) return con;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public TCon[] GetAllConnectors() => connectors.ToArray();
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue