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.
sae201_qwirkle/Qwirkle/QwirkleClassLibrary/Game.cs

87 lines
1.8 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QwirkleClassLibrary
{
public class Game
{
private TileBag bag;
private List<Player> players;
public Game(List<Player> pl)
{
players = pl;
bag = new TileBag();
players[0].IsPlaying = true;
}
public int PositionPlayerPlay()
{
for (int i = 0; i < players.Count; i++)
{
if (players[i].IsPlaying == true)
{
Console.WriteLine(i);
return i;
}
}
return -1;
}
public int GetNbPlayers
{
get { return players.Count; }
}
public void RemoveTileInBagGame(Tile tile)
{
bag.RemoveTileInBag(tile);
}
public List<Tile> Bag
{
get { return bag.TilesInBag(); }
}
public void AddTileInBagOfPlayer(int posplayer, Tile tile)
{
players[posplayer].AddTilePlayer(tile);
}
public void ShowTileOfPlayer(int posplayer)
{
List<Tile> tiles = players[posplayer].Tiles;
string r = ("Tile of " + posplayer + " : ");
foreach(Tile tile in tiles)
{
r = (r + tile.NameColorTile());
}
Console.WriteLine(r);
}
public void SetNextPlayer(int old, int neew)
{
if (old >= 0)
{
players[old].IsPlaying = false;
}
players[neew].IsPlaying = true;
Console.WriteLine(players[neew].GetName + "you have main now !");
}
}
}