本文整理汇总了C#中IGame.EndTurn方法的典型用法代码示例。如果您正苦于以下问题:C# IGame.EndTurn方法的具体用法?C# IGame.EndTurn怎么用?C# IGame.EndTurn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGame
的用法示例。
在下文中一共展示了IGame.EndTurn方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CurrentPlayer_IsRed_AfterBlue
public void CurrentPlayer_IsRed_AfterBlue(IGame game)
{
// :::: ARRANGE ::::
game.EndTurn();
// :::: ACT ::::
game.EndTurn();
// :::: ASSERT ::::
game.CurrentPlayer.Should().Be(Red);
}
示例2: CurrentPlayer_IsBlue_AfterRed
public void CurrentPlayer_IsBlue_AfterRed(IGame game)
{
// :::: ACT ::::
game.EndTurn();
// :::: ASSERT ::::
game.CurrentPlayer.Should().Be(Blue);
}
示例3: MakeMove
public void MakeMove(IGame game)
{
Coordinate playersMove = null;
if (MoveNeeded != null)
{
playersMove = MoveNeeded(game);
}
if (playersMove != null)
{
game.PlayMove(playersMove.XValue, playersMove.YValue, this);
game.EndTurn();
}
}
示例4: PlayTurn
/// <summary>
/// Executes when a game's turn is changed.
/// </summary>
/// <param name="game">The game.</param>
public void PlayTurn(IGame game)
{
var moves = game.GetAvailableMoves(this.Player).ToList();
if (!game.Turn.AreDiceRolled)
{
game.RollDice(this.Player);
}
else if (moves.Count == 0)
{
game.EndTurn(this.Player);
}
else
{
this.MakeMove(game, moves);
}
}
示例5: OnTurnChanged
private static void OnTurnChanged(IGame game, IDictionary<string, IPlayer> players)
{
var turn = game.Turn;
var player = players[turn.Player];
Program.PrintBoard(game, turn, player);
var moves = game.GetAvailableMoves(player).ToList();
if (!turn.AreDiceRolled)
{
Console.Write("Press <Enter> to roll rice.");
Console.ReadLine();
game.RollDice(player);
}
else if (moves.Count == 0)
{
Console.Write("Press <Enter> to end turn.");
Console.ReadLine();
game.EndTurn(player);
}
else
{
var isValidMove = false;
do
{
try
{
var move = Program.SelectMove(moves);
if (move == null)
throw new InvalidOperationException("Illegal move!");
game.PlayMove(player, move);
isValidMove = true;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
} while (!isValidMove);
}
}
示例6: BlueCityAt4x1_ProducesABlueSettler_AfterFiveRounds
public void BlueCityAt4x1_ProducesABlueSettler_AfterFiveRounds(IGame game)
{
// :::: ARRANGE ::::
game.EndTurn();
game.ChangeCityProductionProjectAt(BlueCityTile, Settler);
// :::: ACT ::::
SkipRounds(game, 5);
// :::: ASSERT ::::
game.UnitAt(BlueCityTile).Owner.Should().Be(Blue);
game.UnitAt(BlueCityTile).Type.Should().Be(Settler);
game.UnitAt(BlueCityTile).RemainingMovement.Should().Be(1);
}
示例7: BlueLegionAt3x2_DoesNotMoveMoreThanOneTileDuringARound
public void BlueLegionAt3x2_DoesNotMoveMoreThanOneTileDuringARound(IGame game)
{
// :::: ARRANGE ::::
game.EndTurn();
game.MoveUnit(BlueLegionTile, To(3, 1));
// :::: ACT ::::
game.MoveUnit(From(3, 1), BlueLegionTile);
// :::: ASSERT ::::
game.UnitAt(BlueLegionTile).Should().BeNull();
game.UnitAt(Location(3, 1)).Owner.Should().Be(Blue);
game.UnitAt(Location(3, 1)).Type.Should().Be(Legion);
game.UnitAt(Location(3, 1)).RemainingMovement.Should().Be(0);
}
示例8: BlueLegion_ConquersTheRedCityAt1x1
public void BlueLegion_ConquersTheRedCityAt1x1(IGame game)
{
// :::: ARRANGE ::::
game.EndTurn();
game.MoveUnit(BlueLegionTile, To(2, 1));
SkipRounds(game, 1);
// :::: ACT ::::
game.MoveUnit(From(2, 1), RedCityTile);
// :::: ASSERT ::::
game.CityAt(RedCityTile).Owner.Should().Be(Blue);
}
示例9: BlueLegion_DefeatsTheRedSettlerAt4x3
public void BlueLegion_DefeatsTheRedSettlerAt4x3(IGame game)
{
// :::: ARRANGE ::::
game.EndTurn();
// :::: ACT ::::
game.MoveUnit(BlueLegionTile, RedSettlerTile);
// :::: ASSERT ::::
game.UnitAt(BlueLegionTile).Should().BeNull();
game.UnitAt(RedSettlerTile).Owner.Should().Be(Blue);
game.UnitAt(RedSettlerTile).Type.Should().Be(Legion);
game.UnitAt(RedSettlerTile).RemainingMovement.Should().Be(0);
}
示例10: RedArcherAt2x0_DoesNotMoveTo2x1_WhenBlueIsInTurn
public void RedArcherAt2x0_DoesNotMoveTo2x1_WhenBlueIsInTurn(IGame game)
{
// :::: ARRANGE ::::
game.EndTurn();
// :::: ACT ::::
game.MoveUnit(RedArcherTile, To(2, 1));
// :::: ASSERT ::::
game.UnitAt(RedArcherTile).Owner.Should().Be(Red);
game.UnitAt(RedArcherTile).Type.Should().Be(Archer);
game.UnitAt(RedArcherTile).RemainingMovement.Should().Be(1);
game.UnitAt(Location(2, 1)).Should().BeNull();
}
示例11: Winner_IsBlue_WhenBlueHasConqueredTheRedCity
public void Winner_IsBlue_WhenBlueHasConqueredTheRedCity(IGame game)
{
// :::: ARRANGE ::::
game.EndTurn();
game.MoveUnit(BlueLegionTile, To(2, 1));
SkipRounds(game, 1);
// :::: ACT ::::
game.MoveUnit(From(2, 1), RedCityTile);
// :::: ASSERT ::::
game.Winner.Should().Be(Blue);
}
示例12: RedSettlerAt4x3_DoesNotBuildACity_WhenBlueIsInTurn
public void RedSettlerAt4x3_DoesNotBuildACity_WhenBlueIsInTurn(IGame game)
{
// :::: ARRANGE ::::
game.EndTurn();
// :::: ACT ::::
game.PerformUnitActionAt(RedSettlerTile);
// :::: ASSERT ::::
game.UnitAt(RedSettlerTile).Should().NotBeNull();
game.CityAt(RedSettlerTile).Should().BeNull();
}
示例13: BlueChariotAt4x1_DoesNotFortify_WhenRedIsInTurn
public void BlueChariotAt4x1_DoesNotFortify_WhenRedIsInTurn(IGame game)
{
// :::: ARRANGE ::::
game.EndTurn();
game.ChangeCityProductionProjectAt(BlueCityTile, Chariot);
SkipRounds(game, 4);
game.EndTurn();
// :::: ACT ::::
game.PerformUnitActionAt(BlueCityTile);
// :::: ASSERT ::::
game.UnitAt(BlueCityTile).RemainingMovement.Should().Be(1);
}
示例14: RedArcherAt2x0_DoesNotFortify_WhenBlueIsInTurn
public void RedArcherAt2x0_DoesNotFortify_WhenBlueIsInTurn(IGame game)
{
// :::: ARRANGE ::::
game.EndTurn();
// :::: ACT ::::
game.PerformUnitActionAt(RedArcherTile);
// :::: ASSERT ::::
game.UnitAt(RedArcherTile).RemainingMovement.Should().Be(1);
}