public Level(string name) { Name = name; Map = new Map(File.ReadAllLines(GetFolderName() + "\\map.txt")); Map.CellChange += (x, y, creature) => CellChange?.Invoke(x, y, creature); Map.Die += (x, y, creature) => Die?.Invoke(x, y, creature); Map.Damaged += (x, y, creature, damage) => Damaged?.Invoke(x, y, creature, damage); Map.DoingStarted += (x, y, character, doing) => DoingStarted?.Invoke(x, y, character, doing); Map.DoingEnd += (x, y, character, doing) => DoingEnd?.Invoke(x, y, character, doing); Map.Die += (x, y, creature) => { if (creature is Base _base) { EndWin?.Invoke(!_base.IsPlayerCreature); IsEnd = true; } }; }
public Level(string name, Map map) { Name = name; Map = map; Map.CellChange += (x, y, creature) => CellChange?.Invoke(x, y, creature); Map.Die += (x, y, creature) => Die?.Invoke(x, y, creature); Map.Damaged += (x, y, creature, damage) => Damaged?.Invoke(x, y, creature, damage); Map.DoingStarted += (x, y, character, doing) => DoingStarted?.Invoke(x, y, character, doing); Map.DoingEnd += (x, y, character, doing) => DoingEnd?.Invoke(x, y, character, doing); Map.Die += (x, y, creature) => { if (creature is Base _base) { EndWin?.Invoke(!_base.IsPlayerCreature); IsEnd = true; } }; }