Пример #1
0
		public void CreateALevel()
		{
			level = new Level(new Size(5, 5));
			level.SetTile(new Vector2D(0, 0), LevelTileType.SpawnPoint);
			level.SetTile(new Vector2D(1, 1), LevelTileType.ExitPoint);
			level.SetTile(new Vector2D(2, 2), LevelTileType.BlockedPlaceable);
			level.SetTile(new Vector2D(0, 1), LevelTileType.Blue);
			level.SetTile(new Vector2D(0, 2), LevelTileType.Brown);
			level.SetTile(new Vector2D(0, 3), LevelTileType.Green);
			level.SetTile(new Vector2D(0, 4), LevelTileType.Gray);
			level.SetTile(new Vector2D(1, 0), LevelTileType.Placeable);
			level.SetTile(new Vector2D(1, 2), LevelTileType.Yellow);
			level.SetTile(new Vector2D(1, 3), LevelTileType.Blocked);
			level.SetTile(new Vector2D(1, 4), LevelTileType.Red);
			level.AddWave(new Wave(2.0f, 1.0f, "Test", "Test", 20.0f));
			var stream = new XmlFile(BuildXmlData()).ToMemoryStream();
			var loadedLevel = new MockLevel(new Size(0, 0));
			loadedLevel.LoadData(stream);
			Assert.AreEqual(loadedLevel.Size, level.Size);
			Assert.AreEqual(loadedLevel.MapData[0], level.MapData[0]);
			Assert.AreEqual(loadedLevel.Waves[0].MaxTime, level.Waves[0].MaxTime);
			Assert.AreEqual(loadedLevel.Waves[0].SpawnInterval, level.Waves[0].SpawnInterval);
			Assert.AreEqual(loadedLevel.Waves[0].SpawnTypeList, level.Waves[0].SpawnTypeList);
			Assert.AreEqual(loadedLevel.Waves[0].WaitTime, level.Waves[0].WaitTime);
			level.Dispose();
		}
Пример #2
0
		private void InitializeClasses()
		{
			contentListUpdater = new ContentListUpdater(this, service);
			waveHandler = new WaveHandler(this);
			propertyUpdater = new PropertyUpdater(this);
			xmlSaver = new XmlSaver(service);
			Level = new Level(new Size(12, 12));
			backgroundImageHandler = new BackgroundImageHandler(Level);
			renderer = new LevelDebugRenderer(Level);
			cameraSliders = new CameraSliders(renderer);
			levelObjectHandler = new LevelObjectHandler((int)(Level.Size.Width * Level.Size.Height));
			levelCommands = new LevelEditorCommands(this);
		}
		private void InitializeLevelDebugRenderer(Level level)
		{
			levelDebugRenderer = new LevelDebugRenderer(level);
		}
		private static void AssertObjectListHasLevelSize(int width, int height, int expected)
		{
			var level = new Level(new Size(width, height));
			var handler = new LevelObjectHandler(level);
			Assert.AreEqual(expected, handler.ObjectList.Length);
		}
Пример #5
0
		public LevelObjectHandler(Level level)
			: this((int)level.Size.Width * (int)level.Size.Height) {}
Пример #6
0
		public LevelDebugRenderer(Level map)
		{
			this.map = map;
			RecreateTiles();
			map.TileChanged += UpdateTile;
		}
Пример #7
0
		public BackgroundImageHandler(Level level)
		{
			this.level = level;
		}