本文整理汇总了C#中Game.Move方法的典型用法代码示例。如果您正苦于以下问题:C# Game.Move方法的具体用法?C# Game.Move怎么用?C# Game.Move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game.Move方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Game game = new Game();
game.New();
game.Moving += Game_Moving;
while (true)
{
string res = Console.ReadLine();
string[] resArray = res.Split(' ');
switch (resArray[0])
{
case "e":
return;
case "n":
game.New();
break;
case "r":
Game_Moving(null, new MovingEventArgs(game.GetSquare()));
break;
case "g":
switch (resArray[2])
{
case "u":
game.Move(Convert.ToByte(resArray[1]), Direction.Up);
break;
case "d":
game.Move(Convert.ToByte(resArray[1]), Direction.Down);
break;
case "l":
game.Move(Convert.ToByte(resArray[1]), Direction.Left);
break;
case "r":
game.Move(Convert.ToByte(resArray[1]), Direction.Right);
break;
}
break;
//что-то
}
}
}
示例2: ThrowWhenGameCompleted
public void ThrowWhenGameCompleted()
{
var game = new Game();
var players = PlayerMother.GeneratePlayers(2);
foreach (var player in players)
game.Join(player);
game.Start();
foreach (var player in players)
game.Move(player, Moves.Paper);
Assert.Throws<InvalidGameStateException>(() => game.Join(PlayerMother.GeneratePlayer()));
}
示例3: Act
public override void Act(Game game)
{
game.CurrentPlayer.HasWon = true;
game.IsFinished = true;
game.Move(0);
}
示例4: Act
public override void Act(Game game)
{
game.Move(-4);
}
示例5: ThrowWhenGameNotStarted
public void ThrowWhenGameNotStarted()
{
var game = new Game();
var players = PlayerMother.GeneratePlayers(2).ToArray();
foreach (var player in players)
game.Join(player);
Assert.Throws<InvalidGameStateException>(() => game.Move(players.First(), Moves.Paper));
}