private void PlaceStairs() { foreach (LevelId id in Exits) { LevelId current = Game.World.CurrentLevel; char symbol = '*'; if (id.Name == current.Name) { symbol = id.Depth > current.Depth ? '>' : '<'; } Exit exit = new Exit(id, symbol); bool done = false; while (!Map.Field[exit.Loc].IsWalkable && !done) { Map.GetExit(exit.Loc).Match( some: _ => exit.Loc = new Loc(Rand.Next(1, Width - 1), Rand.Next(1, Height - 1)), none: () => done = true); } Map.AddExit(exit); } }
public WorldHandler(WorldParameter parameters) { _levels = BuildWorld(parameters); CurrentLevel = new LevelId(_ROOT_NAME, RegionType.Root, 1); }
public IEnumerable <Exit> GetExits(LevelId levelId) => Exits.Values.Where(ex => ex.Destination == levelId);