Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (gridmaker.HasMatch())
     {
         Debug.Log("x");
         anim.SetBool("combo", true);
     }
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        moveText.text = "" + moves;
        //Debug.Log("" + moves);


        if (moves == 0)
        {
            SceneManager.LoadScene("End");
        }


        if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow))
        {
            gridmaker.combo = 0;
            Swap(0, -1);

            //play sound
            AudioSource.PlayClipAtPoint(move, transform.position);

            if (gridmaker.HasMatch())
            { //reset moves to 5
                moves = 5;
            }
            else
            {
                moves--;

                //reset combo to 0;
            }
        }


        if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow))
        {
            gridmaker.combo = 0;
            Swap(0, 1);


            //play sound
            AudioSource.PlayClipAtPoint(move, transform.position);

            if (gridmaker.HasMatch())
            {
                moves = 5;
            }
            else
            {
                moves--;
                //reset combo to 0;
            }
        }

        if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))
        {
            gridmaker.combo = 0;
            Swap(1, 0);


            //play sound
            AudioSource.PlayClipAtPoint(move, transform.position);

            if (gridmaker.HasMatch())
            {
                moves = 5;
            }
            else
            {
                moves--;
                //reset combo to 0;
            }
        }

        if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow))
        {
            gridmaker.combo = 0;
            Swap(-1, 0);

            //play sound
            AudioSource.PlayClipAtPoint(move, transform.position);

            if (gridmaker.HasMatch())
            {
                moves = 5;
            }
            else
            {
                moves--;
                //reset combo to 0;
            }
        }
    }