public GameSetupSvc(AppConfigMgnr conf) { int id = -1; FileHelper fReader = new FileHelper(); var persistentLevels = fReader.ReadFromXml<Level>(conf.GetSetting<string>("LevelFile")); AllLevels = new List<NonPersistentLevel>(); int k = 0; foreach (Level level in persistentLevels) { NonPersistentLevel npl = new NonPersistentLevel(); npl.Lvl = level; npl.Coins = new List<Coin>(); int rasterHalb = level.Raster / 2; for (int i = 0; i < level.Height / level.Raster; i++) // vertical { for (int j = 0; j < level.Width / level.Raster; j++) // horizontal { Coin c = new Coin(); c.Pos = new Point() { X = j * level.Raster + rasterHalb, Y = i * level.Raster + rasterHalb }; c.Id = ++id; npl.Coins.Add(c); } } AllLevels.Add(npl); ++k; } }