示例#1
0
//While blocks are not parented, allow movement and quickdrop
    void Update()
    {
        UpdateNeighbors();
        if (transform.parent == null)
        {
            if (rigidbody.isKinematic == true)
            {
                QuickDrop();
                CheckInput();
            }

            Vector3 temp = transform.position;
            temp.x             = Mathf.Clamp(temp.x, xMin, xMax);
            transform.position = temp;
        }

        if (transform.parent != null)
        {
            ActiveSideCheck side = transform.parent.GetComponent <ActiveSideCheck>();
            if (side.isRightSide)
            {
                CheckMatches();
            }
        }
    }
示例#2
0
    void DestroyBlocks(int x, int y)
    {
        ActiveSideCheck side = transform.parent.GetComponent <ActiveSideCheck>();

        if (side.IsRightSide())
        {
            Destroy(Blocks[x], .3f);
            Destroy(Blocks[y], .3f);
            Destroy(gameObject, .3f);
            AddScore();
        }
    }