示例#1
0
    IEnumerator IERotateCounterClockwise()
    {
        if (chosenParent.childCount == 0 || isRotating)
        {
            yield break;
        }
        yield return(StartCoroutine(RotateChosenParent(120)));

        List <Vector2> indexList = new List <Vector2>();

        for (int i = 0; i < 3; i++)
        {
            indexList.Add(chosenObjects[i].Index);
        }
        var tempObj = chosenObjects;

        for (int i = 0; i < 3; i++)
        {
            BoardCells[(int)indexList[(i + 1) % 3].x][(int)indexList[(i + 1) % 3].y].HexObject = tempObj[i];
            chosenObjects[i].Index = indexList[(i + 1) % 3];
        }
        for (int i = 0; i < 3; i++)
        {
            CollectMatched(BoardHelper.GetAllMatchedCells(BoardCells, chosenObjects[i].Index));
        }
        CheckAndSetCollectableObjects();
    }
示例#2
0
    IEnumerator IECheckAndCollectAllMatched()
    {
        // yield break;
        for (int i = 0; i < BoardCells.Length; i++)
        {
            for (int j = 0; j < BoardCells[i].Length; j++)
            {
                CollectMatched(BoardHelper.GetAllMatchedCells(BoardCells, new Vector2(i, j)));
                if (CheckAndSetCollectableObjects())
                {
                    yield return(StartCoroutine(IERelocateHexCell()));

                    yield return(IECheckAndCollectAllMatched());
                }
            }
        }
    }