本文整理汇总了C#中GameMaster.PlayGame方法的典型用法代码示例。如果您正苦于以下问题:C# GameMaster.PlayGame方法的具体用法?C# GameMaster.PlayGame怎么用?C# GameMaster.PlayGame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameMaster
的用法示例。
在下文中一共展示了GameMaster.PlayGame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string [] args)
{
int numberOfPlayers = 0;
Console.WriteLine(" Welcome to MONOPOLY");
Console.WriteLine("______________________________________________________");
Console.WriteLine(" **** Game Started ****");
Console.WriteLine();
Console.Write("Please enter the number of players to start the game : ");
while (!((int.TryParse(Console.ReadLine(), out numberOfPlayers)) &&
((numberOfPlayers >= 2) && (numberOfPlayers <= 8))))
{
Console.WriteLine("Player should between 2 and 8 !");
}
//creating the array of players,die array and the gameBoard that contains 40 cell
Player[] arrayOfPlayers = new Player[numberOfPlayers];
Die[] die = new Die[2];
GameBoard gameBoard = new GameBoard();
for (int i = 0; i < numberOfPlayers; i++)
{
arrayOfPlayers[i] = new Player(5000, "Player" + (i + 1));
arrayOfPlayers[i].Position = gameBoard.GetCell(0);
}
//creating gameMaster
GameMaster gameMaster = new GameMaster(die, gameBoard, arrayOfPlayers);
Console.WriteLine();
if ((args.Length > 0) && args[0].Equals("test"))
{
gameMaster.PlayGame("test");
}
else
{
gameMaster.PlayGame();
}
}