I am trying to create a check between lists, but am having no luck :-/
I have a game board with 100 fields and make this loop to add only empty fields into a new list:
for(int i = 0; i < thisGame.boardFields.Count; i++)
{
if (thisGame.boardFields.Count != 0 && thisGame.boardFields [i] != null)
{
BoardField thisField = thisGame.boardFields [i];
if (thisField.owner == "0" && thisField.number != 13)
{
Tile tTile = new Tile();
tTile.color = thisField.color;
tTile.number = thisField.number.ToString();
tempBoard.Add (tTile);
}
}
}
Then I loop through the players 5 tiles to see if the player has a tile which is not playable, e.g. a empty field with the same object is not available like this:
for (var i = 0; i < thisGame.playerTiles.Count; i++)
{
Tile tempTile = new Tile();
tempTile.color = thisGame.playerTiles[i].color;
tempTile.number = thisGame.playerTiles[i].number.ToString();
if (!tempBoard.Contains (tempTile))
{
testTile = tempTile;
print ("HUSTON WE HAVE A PROBLEM: " + tempTile.color + "-" + tempTile.number);
}
}
This is the definition of the Tile class:
public class Tile
{
public int id;
public string color;
public string number;
}
Now my problem is, that it prints on every 5 tiles in the players tile list? All tiles in the players tile list is available in the tempBoard
list?
What am I missing her?
Hoping for help and thanks in advance :-)