예제 #1
0
    public IEnumerator DeactivateCube(CubeInfo cube)
    {
        //Remove the deactivated cube from the list
        GameObject parent = cube.transform.parent.gameObject;

        //deactivate the block and move it to a holder
        cube.DeactivateCube();
        while (parent.GetComponent <CubeMovement>().isMoving)
        {
            yield return(null);
        }
        activePuzzleBlocks.Remove(parent);
        inactiveBlocks.Add(parent);
        parent.transform.position = inactiveCubeHolder.position;
        parent.transform.parent   = inactiveCubeHolder;

        //Check the type of block that was deactivated - if it was special or forbidden do extra.
        //If forbidden cube was deactivated -3 to block counter
        if (cube.typeOfCube == CubeInfo.CubeType.forbidden)
        {
            DeductFromFallenBlockCounter(3);
        }
        //If it was special mark the 9 floor tiles around the cubes pos as marked.
        if (cube.typeOfCube == CubeInfo.CubeType.special)
        {
            MarkFloorCubesForSpecial(cube.coord);
        }
        CheckIfPuzzleIsFinished();
    }