本文整理汇总了C#中Bullet.Tick方法的典型用法代码示例。如果您正苦于以下问题:C# Bullet.Tick方法的具体用法?C# Bullet.Tick怎么用?C# Bullet.Tick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bullet
的用法示例。
在下文中一共展示了Bullet.Tick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldDieWhenItHitsARobot
public void ShouldDieWhenItHitsARobot()
{
var customRobot = new TestRobot();
var robot = new RobotRunner(customRobot, _battlefield, 1);
var firingRobot = new RobotRunner(customRobot, _battlefield, 1);
_battlefield.Add(robot);
var bullet = new Bullet(_battlefield, robot.X + 30, robot.Y, 180, 30, 3.0m, firingRobot);
bullet.Tick();
Assert.That(bullet.Dead, Is.True);
Assert.That(_battlefield.NewExplosions.Count,Is.EqualTo(1));
Assert.That(robot.Energy, Is.EqualTo(97.0m));
Assert.That(firingRobot.DamageGiven, Is.EqualTo(3.0m));
}
示例2: ShouldDieWhenItExitsTheScreen
public void ShouldDieWhenItExitsTheScreen()
{
var bullet = new Bullet(_battlefield, 20, 21, 180, 30, 3.0m, null);
bullet.Tick();
Assert.That(bullet.Dead, Is.True);
bullet = new Bullet(_battlefield, 780, 21, 0, 30, 3.0m, null);
bullet.Tick();
Assert.That(bullet.Dead, Is.True);
bullet = new Bullet(_battlefield, 20, 21, 90, 30, 3.0m, null);
bullet.Tick();
Assert.That(bullet.Dead, Is.True);
bullet = new Bullet(_battlefield, 20, 780, 270, 30, 3.0m, null);
bullet.Tick();
Assert.That(bullet.Dead, Is.True);
}