Beispiel #1
0
    public void ClearAllBlocks()
    {
        MyAllBlocksSet.Clear();
        LeftColors.Clear();
        if (Blocks != null)
        {
            foreach (Block b in Blocks)
            {
                if (b)
                {
                    b.PoolRecycle();
                }
            }
        }

        if (MegaBlocks != null)
        {
            foreach (Block mb in MegaBlocks)
            {
                if (mb)
                {
                    mb.PoolRecycle();
                }
            }
        }

        foreach (Block b in GetComponentsInChildren <Block>(true))
        {
            b.PoolRecycle();
        }

        Grid = new int[GameManager.Instance.Width, GameManager.Instance.Height];
        for (int i = 0; i < GameManager.Instance.Width; i++)
        {
            for (int j = 0; j < GameManager.Instance.Height; j++)
            {
                Grid[i, j] = -1;
            }
        }

        if (currentBlockGroup != null)
        {
            Block[] children = currentBlockGroup.transform.GetComponentsInChildren <Block>(true);
            foreach (Block child in children)
            {
                child.PoolRecycle();
            }

            currentBlockGroup.PoolRecycle();
            currentBlockGroup = null;
        }

        Blocks             = new Block[GameManager.Instance.Width, GameManager.Instance.Height];
        MegaBlocks         = new List <Block>();
        MegaBlock_Pointers = new Block[GameManager.Instance.Width, GameManager.Instance.Height];
    }