Answer the question
In order to leave comments, you need to log in
Move counter?
Hello. Could you tell me how to implement the counter of moves correctly? In my written code, it turns out that the moves are counted incorrectly. Either they add, then they decrease, or they can even add / decrease for a couple of moves. And I need the counter to add moves by 1 unit.
The actual code
if (cardBack.activeSelf && controller.canReveal) {
cardBack.SetActive(false);
controller.CardRevealed(this);
Moves += 1f; // тут прибавляю в счетчик +1
. public bool canReveal
{
get { return _secondRevealed == null; }
}
public void CardRevealed(MemoryCard card)
{
if (_firstRevealed == null)
{
_firstRevealed = card;
}
else
{
_secondRevealed = card;
StartCoroutine(CheckMatch());
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question