本文整理汇总了C#中Game.Command方法的典型用法代码示例。如果您正苦于以下问题:C# Game.Command方法的具体用法?C# Game.Command怎么用?C# Game.Command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game.Command方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItAnnouncesNoArrowsIfThePlayerHasNone
public void ItAnnouncesNoArrowsIfThePlayerHasNone()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
map.AddPath(0, 1, Command.Directions.East);
map.PlaceItem(0, MapItems.Player);
game.Command(new Command {
Direction = Command.Directions.East,
Order = Command.Commands.Shoot});
presenter.Received().OutOfArrows();
}
示例2: ItAnnouncesTheArrowKilledThePlayerIfHeShootsAWall
public void ItAnnouncesTheArrowKilledThePlayerIfHeShootsAWall()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
game.SetPlayerQuiver(1);
map.PlaceItem(0, MapItems.Player);
game.Command(new Command
{
Direction = Command.Directions.East,
Order = Command.Commands.Shoot
});
presenter.Received().Suicide();
}
示例3: ItAnnouncesGameOverOnPlayerDeath
public void ItAnnouncesGameOverOnPlayerDeath()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
game.SetPlayerQuiver(1);
map.PlaceItem(0, MapItems.Player);
game.Command(new Command
{
Direction = Command.Directions.East,
Order = Command.Commands.Shoot
});
presenter.Received().GameOver();
}
示例4: KillWumpus
protected void KillWumpus(Game game, Map map)
{
game.SetPlayerQuiver(1);
map.PlaceItem(0, MapItems.Player);
map.PlaceItem(2, MapItems.Wumpus);
map.AddPath(0, 1, Command.Directions.East);
map.AddPath(0, 2, Command.Directions.East);
game.Command(new Command
{
Direction = Command.Directions.East,
Order = Command.Commands.Shoot
});
}
示例5: TheGameIsNotOverIfItHasBeenRestarted
public void TheGameIsNotOverIfItHasBeenRestarted()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
game.SetPlayerQuiver(1);
map.PlaceItem(0, MapItems.Player);
game.Command(new Command
{
Order = Command.Commands.Shoot,
Direction = Command.Directions.East
});
game.Restart();
Assert.IsFalse(game.IsOver());
}
示例6: ItSetsTheGameToOverOnPlayerDeath
public void ItSetsTheGameToOverOnPlayerDeath()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
game.SetPlayerQuiver(1);
map.PlaceItem(0, MapItems.Player);
Assert.IsFalse(game.IsOver());
game.Command(new Command
{
Direction = Command.Directions.East,
Order = Command.Commands.Shoot
});
Assert.IsTrue(game.IsOver());
}
示例7: ItRemovesAnArrowFromTheQuiverWhenAShotIsFired
public void ItRemovesAnArrowFromTheQuiverWhenAShotIsFired()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
game.SetPlayerQuiver(5);
map.PlaceItem(0, MapItems.Player);
game.Command( new Command {
Order = Command.Commands.Shoot,
Direction = Command.Directions.East});
Assert.AreEqual(4, game.PlayerArrows());
}
示例8: ItAnnouncesWhenAPlayerFindsAnArrow
public void ItAnnouncesWhenAPlayerFindsAnArrow()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
map.AddPath(0, 1, Command.Directions.North);
map.PlaceItem(0, MapItems.Player);
map.PlaceItem(1, MapItems.Arrow);
game.Command(new Command{ Order = Command.Commands.Go,
Direction = Command.Directions.North});
presenter.Received().FoundAnArrow();
}
示例9: ItMovesAnArrowInTheCommandedDirection
public void ItMovesAnArrowInTheCommandedDirection()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
game.SetPlayerQuiver(1);
map.PlaceItem(0, MapItems.Player);
map.AddPath(0, 1, Command.Directions.East);
game.Command(new Command {
Direction = Command.Directions.East,
Order = Command.Commands.Shoot});
Assert.AreEqual(MapItems.Arrow, map.ItemsInCavern(1)[0]);
}
示例10: ItDoesntShootIfThePlayerHasNoArrows
public void ItDoesntShootIfThePlayerHasNoArrows()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
map.AddPath(0, 1, Command.Directions.East);
map.PlaceItem(0, MapItems.Player);
game.Command(new Command {
Direction = Command.Directions.East,
Order = Command.Commands.Shoot
});
presenter.DidNotReceive().ArrowWasFired();
Assert.AreEqual(0, map.ArrowsInCavern(1));
}
示例11: ItDoesntMoveTheWumpusIfTheWumpusIsntPlaced
public void ItDoesntMoveTheWumpusIfTheWumpusIsntPlaced()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var mover = Substitute.For<WumpusMover>();
mover.Move(map).Returns(4);
var game = new Game(presenter, map)
{
Mover = mover
};
game.Command(new Command
{
Order = Command.Commands.Rest
});
Assert.IsFalse(map.HasWumpusIn(4));
}
示例12: ItDoesntAnnounceWhenThePlayerDoesNotFindAnArrow
public void ItDoesntAnnounceWhenThePlayerDoesNotFindAnArrow()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
map.AddPath(0, 1, Command.Directions.North);
map.PlaceItem(0, MapItems.Player);
game.Command(new Command {
Direction = Command.Directions.North,
Order = Command.Commands.Go});
presenter.DidNotReceive().FoundAnArrow();
}
示例13: ItContinuesMovingTheArrowUntilThereAreNoMovesInThatDirection
public void ItContinuesMovingTheArrowUntilThereAreNoMovesInThatDirection()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
game.SetPlayerQuiver(1);
map.PlaceItem(0, MapItems.Player);
map.AddPath(0, 1, Command.Directions.East);
map.AddPath(1, 2, Command.Directions.East);
game.Command( new Command {
Order = Command.Commands.Shoot,
Direction = Command.Directions.East});
Assert.AreEqual(MapItems.Arrow, map.ItemsInCavern(2)[0]);
}
示例14: ItAnnouncesWhenYouCanSmellTheWumpus
public void ItAnnouncesWhenYouCanSmellTheWumpus()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
map.AddPath(0, 1, Command.Directions.West);
map.AddPath(1, 2, Command.Directions.South);
map.PlaceItem(0, MapItems.Player);
map.PlaceItem(2, MapItems.Wumpus);
game.Command(new Command {
Direction = Command.Directions.West,
Order = Command.Commands.Go
});
presenter.Received().WumpusCanSeeYou();
}
示例15: ItAnnouncesTheArrowWasShot
public void ItAnnouncesTheArrowWasShot()
{
var presenter = Substitute.For<Presenter>();
var map = new Map();
var game = new Game(presenter, map);
game.SetPlayerQuiver(1);
map.PlaceItem(0, MapItems.Player);
map.AddPath(0, 1, Command.Directions.East);
game.Command(new Command {
Direction = Command.Directions.East,
Order = Command.Commands.Shoot});
presenter.Received().ArrowWasFired();
}