- Home /
Foreach with where with 2 lists
Dear C#/Unity developers,
I am at the moment busy with developing my first game, it is a card game similar to spades.
I have the following problem:
For the game logic I must disable the cards which the user can't use following the rules, for that I make use of 2 lists
1st list holds all the cards the user has in his deck 2nd list holds all the cards the player can use when it's his turn.
I want to loop through the 1st list and disable the cards that doesn't match with the cards in the 2nd list. Is there an simple solution for?
foreach (var card in Deck.Where(x => x.card != TodisableCards.cards))
{
card.GetComponent<BoxCollider2D>().enabled = false;
}
With "TodisableCards.cards" I mean all the cards it has. I want to use something like this, if it is possible.
Thanks in advance. Speedt4
Your answer
Follow this Question
Related Questions
Brute Force Search Algorithm 0 Answers
Multiple Cars not working 1 Answer
Check if all values in a list are equal 1 Answer
Distribute terrain in zones 3 Answers
A node in a childnode? 1 Answer