// Update is called once per frame
    void Update()
    {
#if UNITY_EDITOR
        if (Input.GetMouseButtonDown(0))
        {
//			Debug.Log("chay bao nhieu lan day ");
            RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

            if (hit.collider != null)
            {
                if (hit.collider.gameObject != null && hit.collider.gameObject.tag == "blank_block")
                {
                    bool fightWithAI = gameLogic.fightWithAI;
                    if (!fightWithAI || (fightWithAI && gameLogic.gameState == GameState.White_move))
                    {
                        if (previewGO != null)
                        {
                            gameLogic.changePreviewToBlank(previewGO);
                        }
                        previewGO = hit.collider.gameObject;
                        gameLogic.changeToPreviewSpriteAtLocation(previewGO);
                    }
                }
            }
        }
#else
        if (Input.GetMouseButtonDown(0))
        {
            int nbTouches = Input.touchCount;
            if (nbTouches > 0)
            {
                Debug.Log("numb = " + nbTouches);
                for (int i = 0; i < nbTouches; i++)
                {
                    Touch touch = Input.GetTouch(i);

                    if (touch.phase == TouchPhase.Began)
                    {
                        RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

                        if (hit.collider != null)
                        {
                            if (hit.collider.gameObject != null && hit.collider.gameObject.tag == "blank_block")
                            {
                                bool fightWithAI = gameLogic.fightWithAI;
                                if (!fightWithAI || (fightWithAI && gameLogic.gameState == GameState.White_move))
                                {
                                    if (previewGO != null)
                                    {
                                        gameLogic.changePreviewToBlank(previewGO);
                                    }
                                    previewGO = hit.collider.gameObject;
                                    gameLogic.changeToPreviewSpriteAtLocation(previewGO);
                                }
                            }
                        }
                    }
                }
            }
        }
                                #endif
    }