F
F
f0rs2016-01-22 00:25:45
C++ / C#
f0rs, 2016-01-22 00:25:45

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
.
code from the second script
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

1 answer(s)
V
Vitaly Yakovenko, 2016-01-22
@Xazzzi

Why is the move counter float? It's kind of illogical.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question