/// <summary> /// When clicking on card changes it's state from red to blue. /// </summary> /// <remarks> /// Gets the action if the mouse is pressed. ///</remarks> void OnMouseDown() { // React to the click on the card. if (Input.GetMouseButtonDown(0)) { // Check if the value of the card is blue and turn it red. if (cardState == State.Blue) { // Set the card state to red and update the sprite cardState = State.Red; UpdateCardSprite(); // Flip the adjacent card and card below if needed tmp.FlipCards(cardLevel, cardPos, CardGame.Opers.OpenBelow); } else if (cardState == State.Red) { // Flip the previous cards tmp.FlipCards(cardLevel, cardPos, CardGame.Opers.OpenAbove); } } }