Example #1
0
    public void Execute(GameObject button)
    {
        int x = button.GetComponent <ButtonScript>().X;
        int y = button.GetComponent <ButtonScript>().Y;

        if (modelScr.IfCanMove(x, y))
        {
            button.GetComponent <ButtonScript>().Move(tab[modelScr.EmptyIndexX, modelScr.EmptyIndexY], tab);
            Move(x, y);
            modelScr.Move(x, y);
            if (modelScr.IsEnd())
            {
                foreach (GameObject go in tab)
                {
                    Destroy(go, 0.6f);
                }
                StartCoroutine(guiScr.ShowWinner(gameObject, spr));
            }
        }
    }