You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.5 KiB
46 lines
1.5 KiB
using Model.Dice;
|
|
using Model.Players;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Model.Games
|
|
{
|
|
public class MasterOfCeremonies
|
|
{
|
|
public IManager<Player> GlobalPlayerManager { get; private set; }
|
|
public IManager<KeyValuePair<string, IEnumerable<Die>>> DiceGroupManager { get; private set; }
|
|
public IManager<Game> GameManager { get; private set; }
|
|
|
|
public MasterOfCeremonies(IManager<Player> globalPlayerManager, IManager<KeyValuePair<string, IEnumerable<Die>>> globalDiceGroupManager, IManager<Game> gameManager)
|
|
{
|
|
GlobalPlayerManager = globalPlayerManager;
|
|
DiceGroupManager = globalDiceGroupManager;
|
|
GameManager = gameManager;
|
|
}
|
|
|
|
/// <summary>
|
|
/// creates a new game
|
|
/// </summary>
|
|
/// <param name="name"></param>
|
|
/// <param name="playerManager"></param>
|
|
/// <param name="dice"></param>
|
|
/// <returns></returns>
|
|
public Game StartNewGame(string name, IManager<Player> playerManager, IEnumerable<Die> dice)
|
|
{
|
|
Game game = new(name, playerManager, dice);
|
|
return GameManager.Add(game);
|
|
}
|
|
|
|
/// <summary>
|
|
/// plays one turn of the game
|
|
/// </summary>
|
|
/// <param name="game">the game from which a turn will be played</param>
|
|
public static void PlayGame(Game game)
|
|
{
|
|
Player current = game.GetWhoPlaysNow();
|
|
game.PerformTurn(current);
|
|
game.PrepareNextPlayer(current);
|
|
}
|
|
|
|
}
|
|
}
|