本文整理汇总了C#中Game1.Tick方法的典型用法代码示例。如果您正苦于以下问题:C# Game1.Tick方法的具体用法?C# Game1.Tick怎么用?C# Game1.Tick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game1
的用法示例。
在下文中一共展示了Game1.Tick方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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());
}
示例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);
}
示例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}));
}