Example #1
0
    private void OnMouseDown()
    {
        if (spriteRenderer.sprite == null || BoardManager.sharedInstance.isShifting)
        {
            return;
        }
        else
        {
            if (isSelected)
            {
                audioSource.Play();
                DeselectGems();
            }
            else
            {
                if (previousSelected == null)
                {
                    SelectGems();
                    audioSource.enabled = false;
                }
                else
                {
                    if (CanSwipe())
                    {
                        SwapSprite(previousSelected);

                        previousSelected.FindAllMatches();
                        previousSelected.DeselectGems();
                        FindAllMatches();
                        Pontuacao.sharedInstance.MovimentacaoContador--;
                    }
                    else
                    {
                        previousSelected.DeselectGems();
                    }
                }
            }
        }
    }