Example #1
0
    private void Update()
    {
        if (isCombine)
        {
            if (combinedBlock != null && !isMove)
            {
                if (!combinedBlock.isMove)
                {
                    Combine();
                    BlockController blockController = GameObject.FindGameObjectWithTag("NumBlockManeger").GetComponent <BlockController>();
                    blockController.AddScore(blockNumber);
                }
            }
        }

        if (isMove)
        {
            float   speed   = blockMoveSpeed * Time.deltaTime;
            Vector3 current = transform.position;

            transform.position = Vector3.MoveTowards(current, targetPosition, speed);

            if (transform.position == targetPosition)
            {
                MoveEnd();
            }
        }
    }