Exemple #1
0
    private void GeneralMove()
    {
        targetX = column;
        targetY = row;
        if (Mathf.Abs(targetX - transform.position.x) > .1f)
        {
            tempPos            = new Vector2(targetX, transform.position.y);
            transform.position = Vector2.Lerp(transform.position, tempPos, smoothLerp);
            if (board.allGems[column, row] != this.gameObject)
            {
                board.allGems[column, row] = this.gameObject;
            }

            matchHandler.FindAllMatches();
        }
        else
        {
            tempPos            = new Vector2(targetX, transform.position.y);
            transform.position = tempPos;
        }

        if (Mathf.Abs(targetY - transform.position.y) > .1f)
        {
            tempPos            = new Vector2(transform.position.x, targetY);
            transform.position = Vector2.Lerp(transform.position, tempPos, smoothLerp);
            if (board.allGems[column, row] != this.gameObject)
            {
                board.allGems[column, row] = this.gameObject;
            }

            matchHandler.FindAllMatches();
        }
        else
        {
            tempPos            = new Vector2(transform.position.x, targetY);
            transform.position = tempPos;
        }
    }