Example #1
0
    void OnMouseDown()
    {
        if (!_GameController.m_GamePause)
        {
            if (m_GemRender.sprite == null)
            {
                return;
            }

            if (m_IsSelected)
            {
                Deselect();
            }
            else
            {
                if (m_Previous == null)
                {
                    Select();
                }
                else
                {
                    if (GetAllAdjacentGems().Contains(m_Previous.gameObject))
                    {
                        Swap(this.GetComponent <GemController>(), m_Previous.m_GemRender);
                        m_Previous.ClearAllMatches();
                        m_Previous.Deselect();
                        ClearAllMatches();
                    }
                    else
                    {
                        m_Previous.GetComponent <GemController>().Deselect();
                        Select();
                    }
                }
            }
        }
    }