当前位置: 首页>>代码示例>>C#>>正文


C# Game1.LoadLevel方法代码示例

本文整理汇总了C#中Game1.LoadLevel方法的典型用法代码示例。如果您正苦于以下问题:C# Game1.LoadLevel方法的具体用法?C# Game1.LoadLevel怎么用?C# Game1.LoadLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game1的用法示例。


在下文中一共展示了Game1.LoadLevel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlayerController

        public void VerifyThatListOfItemsIsSuitablyAdjustedWhenGameObjectMovesFromAnAdditionalOccupiedSpaceToAnotherOccupiedSpace()
        {
            var instructions = new[]
                {
                new PlayerController.TimedInstruction(TimeSpan.Zero, new PlayerController.Instruction(Direction.Right, FiringState.None, FiringState.None)),
                new PlayerController.TimedInstruction(TimeSpan.FromMilliseconds(100), new PlayerController.Instruction(Direction.Right, FiringState.None, FiringState.None))
                };

            var pc = new PlayerController(instructions);
            var wl = new WorldLoaderForTest();
            var g = new Game1(pc, wl);
            g.Components.Add(new SuppressDrawComponent(g));
            g.LoadLevel("pg");
            var w = g.World;
            w.AddGrave(new TilePos(0, 0));

            while (!pc.HasFinishedQueue || w.IsAnythingMoving())
                {
                g.Tick();
                }

            var list = w.GameObjects.GetItemsOnTile(new TilePos(0, 0)).ToList();
            Assert.IsNotNull(list);
            Assert.AreEqual(1, list.Count);
            Assert.IsTrue(list[0] is Grave);

            list = w.GameObjects.GetItemsOnTile(new TilePos(1, 0)).ToList();
            Assert.NotNull(list);
            Assert.AreEqual(2, list.Count);
            Assert.IsTrue(list[0] is Grave);
            Assert.IsTrue(list[1] is Player);
        }
开发者ID:JonSaffron,项目名称:Labyrinth,代码行数:32,代码来源:TestMortonCode.cs

示例2: TestPlayerShootsAdjacentBoulder

        public void TestPlayerShootsAdjacentBoulder()
        {
            var instructions = new[]
                {
                new PlayerController.TimedInstruction(TimeSpan.Zero, new PlayerController.Instruction(Direction.None, FiringState.Pulse, FiringState.None)),
                new PlayerController.TimedInstruction(TimeSpan.Zero, PlayerController.Instruction.DoNothingInstruction())
                };

            var pc = new PlayerController(instructions);
            var wl = new WorldLoaderForTest();
            var g = new Game1(pc, wl);
            g.Components.Add(new SuppressDrawComponent(g));
            g.LoadLevel("# bp ");
            var w = g.World;

            while (!pc.HasFinishedQueue || w.IsAnythingMoving())
                {
                g.Tick();
                }

            var list = w.GameObjects.GetItemsOnTile(new TilePos(1, 0)).ToList();
            Assert.IsNotEmpty(list);
            Assert.AreEqual(1, list.Count);
            Assert.IsTrue(list[0] is Boulder);
        }
开发者ID:JonSaffron,项目名称:Labyrinth,代码行数:25,代码来源:ShootBoulderTest.cs

示例3: TestPlayerCannotShootBoulder2

        public void TestPlayerCannotShootBoulder2()
        {
            var instructions = new[]
                {
                new PlayerController.TimedInstruction(TimeSpan.Zero, new PlayerController.Instruction(Direction.None, FiringState.Pulse, FiringState.None)),
                new PlayerController.TimedInstruction(TimeSpan.Zero, PlayerController.Instruction.DoNothingInstruction())
                };

            var pc = new PlayerController(instructions);
            var wl = new WorldLoaderForTest();
            var g = new Game1(pc, wl);
            g.Components.Add(new SuppressDrawComponent(g));
            g.LoadLevel("# bbp ");
            var w = g.World;

            while (!pc.HasFinishedQueue)
                {
                g.Tick();
                }

            Assert.IsFalse(w.GameObjects.DoesShotExist());
        }
开发者ID:JonSaffron,项目名称:Labyrinth,代码行数:22,代码来源:ShootBoulderTest.cs

示例4: TestPlayerBouncesOneBoulderAndEndsUpPushingAnother

        public void TestPlayerBouncesOneBoulderAndEndsUpPushingAnother()
        {
            var instructions = new[]
                {
                new PlayerController.TimedInstruction(TimeSpan.Zero, new PlayerController.Instruction(Direction.Left, FiringState.None, FiringState.None)),
                new PlayerController.TimedInstruction(TimeSpan.FromMilliseconds(200), PlayerController.Instruction.DoNothingInstruction())
                };

            var pc = new PlayerController(instructions);
            var wl = new WorldLoaderForTest();
            var g = new Game1(pc, wl);
            g.Components.Add(new SuppressDrawComponent(g));
            g.LoadLevel("#bpb #");
            var w = g.World;

            while (!pc.HasFinishedQueue || w.IsAnythingMoving())
                {
                g.Tick();
                }

            var list = w.GameObjects.GetItemsOnTile(new TilePos(1, 0)).ToList();
            Assert.NotNull(list);
            Assert.IsEmpty(list);

            list = w.GameObjects.GetItemsOnTile(new TilePos(2, 0)).ToList();
            Assert.NotNull(list);
            Assert.AreEqual(1, list.Count);
            Assert.IsTrue(list[0] is Boulder);

            list = w.GameObjects.GetItemsOnTile(new TilePos(3, 0)).ToList();
            Assert.NotNull(list);
            Assert.AreEqual(1, list.Count);
            Assert.IsTrue(list[0] is Player);

            list = w.GameObjects.GetItemsOnTile(new TilePos(4, 0)).ToList();
            Assert.NotNull(list);
            Assert.AreEqual(1, list.Count);
            Assert.IsTrue(list[0] is Boulder);
        }
开发者ID:JonSaffron,项目名称:Labyrinth,代码行数:39,代码来源:PushAndBounceBackTest.cs

示例5: VerifyThatTheListOfItemsMovesWhenGameObjectMovesToAnAdjacentEmptySpace

        public void VerifyThatTheListOfItemsMovesWhenGameObjectMovesToAnAdjacentEmptySpace()
        {
            var instructions = new[]
                {
                new PlayerController.TimedInstruction(TimeSpan.Zero, new PlayerController.Instruction(Direction.Right, FiringState.None, FiringState.None)),
                new PlayerController.TimedInstruction(TimeSpan.FromMilliseconds(100), new PlayerController.Instruction(Direction.Right, FiringState.None, FiringState.None))
                };

            var pc = new PlayerController(instructions);
            var wl = new WorldLoaderForTest();
            var g = new Game1(pc, wl);
            g.Components.Add(new SuppressDrawComponent(g));
            g.LoadLevel("p ");
            var w = g.World;

            while (!pc.HasFinishedQueue || w.IsAnythingMoving())
                {
                g.Tick();
                }

            Assert.IsEmpty(w.GameObjects.GetItemsOnTile(new TilePos(0, 0)));
            var list = w.GameObjects.GetItemsOnTile(new TilePos(1, 0)).ToList();
            Assert.IsNotEmpty(list);
            Assert.IsTrue(list.SequenceEqual(new List<StaticItem> {w.Player}));
        }
开发者ID:JonSaffron,项目名称:Labyrinth,代码行数:25,代码来源:TestMortonCode.cs

示例6: TestPlayerCannotBouncesOneBoulderBecauseAnotherBoulderBehindCannotMove

        public void TestPlayerCannotBouncesOneBoulderBecauseAnotherBoulderBehindCannotMove()
        {
            var pc = new PlayerController();
            var wl = new WorldLoaderForTest();
            var g = new Game1(pc, wl);
            g.Components.Add(new SuppressDrawComponent(g));
            g.LoadLevel("#bpb#");
            var w = g.World;

            Assert.IsFalse(w.Player.CanMoveInDirection(Direction.Left));

            var boulder1 = (Boulder) w.GameObjects.GetItemsOnTile(new TilePos(1, 0)).ElementAt(0);
            boulder1.PushOrBounce(w.Player, Direction.Left);
            Assert.AreEqual(Direction.None, w.Player.Direction);

            Assert.AreEqual(Direction.None, boulder1.Direction);
        }
开发者ID:JonSaffron,项目名称:Labyrinth,代码行数:17,代码来源:PushAndBounceBackTest.cs


注:本文中的Game1.LoadLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。