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/Cell.cs

53 lines
1.1 KiB

// ReSharper disable All
using System.Runtime.CompilerServices;
namespace QwirkleClassLibrary;
public class Cell
{
private int x;
private int y;
private Tile? tile = null;
public Cell(int x, int y)
{
this.x = x;
this.y = y;
Console.WriteLine("Cell (" + x + ", " + y + ") created");
}
public int GetX
{
get { return x; }
}
public int GetY
{
get { return y; }
}
public bool IsFree
{
get { return tile == null; }
}
public Tile? GetTile
{
get { return tile; }
}
public bool SetTile(Tile addedTile)
{
if(tile == null)
{
tile = addedTile;
Console.WriteLine("The tile of shape " + addedTile.GetShape + " and color " + addedTile.GetColor + " has correctly been added to the cell of coordinates x = " + this.x + ", y = " + this.y);
return true;
}
else
{
Console.WriteLine("There already is a tile in this cell !!");
return false;
}
}
}