28 lines
No EOL
810 B
C#
28 lines
No EOL
810 B
C#
namespace GlobalClassLib;
|
|
|
|
public abstract class GlobalEnemy<TTile, TCon> where TTile : GlobalMapTile<TCon, TTile> where TCon : GlobalTileConnector<TTile, TCon> {
|
|
public TTile? Location { get; set; }
|
|
public bool Visible { get; set; }
|
|
public int Id { get; }
|
|
public abstract string Name{ get; }
|
|
public abstract EnemyType Type{ get; }
|
|
|
|
// ReSharper disable once StaticMemberInGenericType
|
|
private static int nextId = 0;
|
|
|
|
public GlobalEnemy() {
|
|
Id = nextId++;
|
|
}
|
|
|
|
public GlobalEnemy(int id) {
|
|
Id = id;
|
|
}
|
|
public virtual void Spawn(TTile location) {
|
|
Location = location;
|
|
Visible = true;
|
|
Console.WriteLine($"Enemy {Id} ({Name}) spawned at {location.Id} {location.GridPosition}");
|
|
}
|
|
|
|
public virtual void Update() { }
|
|
|
|
} |