Ejemplo n.º 1
0
    public void SelectGemstone(Gemstone c)
    {
        //Destroy (c.gameObject);
        if (true == switch_flag)
        {
            return;
        }

        if (currentgemstone == null)
        {
            currentgemstone = c;
            currentgemstone.IsGemstoneSelected(true); // = true;
            //currentgemstone.ShakeToPosition();
        }
        else
        {
            if (1 == (Mathf.Abs(currentgemstone.RowIndex - c.RowIndex) + Mathf.Abs(currentgemstone.ColIndex - c.ColIndex)))              //相邻的
            {
                switch_flag = true;
                StartCoroutine(ExchangeAndMatcheGemstone(currentgemstone, c));
            }
            else
            {
                audiosource.PlayOneShot(ErrorSound);
            }
            currentgemstone.IsGemstoneSelected(false); // = false;
            currentgemstone = null;
        }
    }