コード例 #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
ファイル: LevelTests.cs プロジェクト: whztt07/DeltaEngine
		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();
		}
コード例 #3
0
		private MockLevel InitializeLevel(bool isLevel3D)
		{
			is3D = isLevel3D;
			var level = new MockLevel(new Size(5));
			level.RenderIn3D = is3D;
			level.SetTile(Vector2D.UnitX, LevelTileType.Red);
			level.SetTile(Vector2D.UnitY, LevelTileType.Green);
			level.SetTile(Vector2D.Zero, LevelTileType.Blue);
			return level;
		}
コード例 #4
0
        private MockLevel InitializeLevel(bool isLevel3D)
        {
            is3D = isLevel3D;
            var level = new MockLevel(new Size(5));

            level.RenderIn3D = is3D;
            level.SetTile(Vector2D.UnitX, LevelTileType.Red);
            level.SetTile(Vector2D.UnitY, LevelTileType.Green);
            level.SetTile(Vector2D.Zero, LevelTileType.Blue);
            return(level);
        }
コード例 #5
0
        private void InitializeWithLevel3D()
        {
            MockLevel level = InitializeLevel(true);

            InitializeLevelDebugRenderer(level);
        }
コード例 #6
0
        private void InitializeWithLevel2D()
        {
            MockLevel level = InitializeLevel(false);

            InitializeLevelDebugRenderer(level);
        }