Пример #1
0
 private void LoadCollisionData(FileFormats.Levels.LevelFile levelData)
 {
     Level = new Level(levelData.Width, levelData.Height);
     for (int y = 0; y < levelData.CollisionMap.Height; y++)
     {
         for (int x = 0; x < levelData.CollisionMap.Width; x++)
         {
             Level.Cells[x, y] = levelData.CollisionMap.Data[y][x];
         }
     }
 }
Пример #2
0
        public void LoadLevel(FileFormats.Levels.LevelFile levelData)
        {
            Entities.Clear();

            Entities.Add(new Crate(new Vector(600, 330)));
            Entities.Add(new WeaponCollectable(WeaponType.Shotgun, new Vector(300, 330)));
            Entities.Add(new ArmorCollectable(new Vector(200, 330)));
            Entities.Add(new MedpackCollectable(new Vector(240, 330)));

            LoadCollisionData(levelData);
            LoadEnemies(levelData.Enemies);
            InitializePlayer();
        }
Пример #3
0
        public static void Save(LevelFile level, string file)
        {
            var jsonLevel = JsonConvert.SerializeObject(level, Formatting.Indented);

            File.WriteAllText(file, jsonLevel, Encoding.UTF8);
        }