예제 #1
0
    public static bool hasDestroyEffect(BlockComboType blockComboType)

    /* Return whether or not this block combo type has a destroy effect.
     *
     * :param BlockComboType blockComboType:
     *
     * :returns bool:
     */
    {
        return(
            blockComboType == BlockComboType.CHECKER_BLUE_RED ||
            blockComboType == BlockComboType.CHECKER_YELLOW_RED
            );
    }
예제 #2
0
    public static bool isProductive(BlockComboType blockComboType)

    /* Return whether or not this block combo type has a produce effect.
     *
     * :param BlockComboType blockComboType:
     *
     * :returns bool:
     */
    {
        return(
            blockComboType == BlockComboType.PRODUCTION_LINE ||
            blockComboType == BlockComboType.CHECKER_BLUE_YELLOW
            );
    }
예제 #3
0
 public BlockCombo(List <Block> blocks_arg, BlockComboType blockComboType_arg)
 {
     blocks         = blocks_arg;
     blockComboType = blockComboType_arg;
 }
예제 #4
0
    private static List <BlockCombo> checkerCombosAnchoredAt(Vector2 gridIndices, BlockComboType blockComboType)

    /* Look for the checker combos at this square, for a certain pair of block types.
     *
     * :param Vector2 gridIndices:
     * :param BlockType[] blockTypes: Pair of block types we are checking for. Must be length 2.
     *
     * :returns List<BlockCombo>:
     */
    {
        List <BlockCombo> combos = new List <BlockCombo>();

        BlockType[] blockTypes;
        if (blockComboType == BlockComboType.CHECKER_BLUE_YELLOW)
        {
            blockTypes = new BlockType[2] {
                BlockType.BLUE, BlockType.YELLOW
            };
        }
        else if (blockComboType == BlockComboType.CHECKER_BLUE_RED)
        {
            blockTypes = new BlockType[2] {
                BlockType.BLUE, BlockType.RED
            };
        }
        else if (blockComboType == BlockComboType.CHECKER_YELLOW_RED)
        {
            blockTypes = new BlockType[2] {
                BlockType.YELLOW, BlockType.RED
            };
        }
        else
        {
            // Invalid BlockComboType was passed in.
            return(combos);
        }

        BlockType?blockTypeA = TrialLogic.getBlockTypeOfSquare(gridIndices);

        // If this square doesn't have one of the block types we're checking for, return no combos.
        if (blockTypeA == null || !blockTypes.Contains((BlockType)blockTypeA))
        {
            return(combos);
        }

        BlockType blockTypeB = blockTypeA == blockTypes[0] ? blockTypes[1] : blockTypes[0];

        Vector2 topRight    = new Vector2(gridIndices.x + 1, gridIndices.y);
        Vector2 bottomLeft  = new Vector2(gridIndices.x, gridIndices.y - 1);
        Vector2 bottomRight = new Vector2(gridIndices.x + 1, gridIndices.y - 1);

        bool isAMatch = (
            TrialLogic.getBlockTypeOfSquare(topRight) == blockTypeB &&
            TrialLogic.getBlockTypeOfSquare(bottomLeft) == blockTypeB &&
            TrialLogic.getBlockTypeOfSquare(bottomRight) == blockTypeA
            );

        // If the 4 squares aren't the combo we're looking for, return no combos.
        if (!isAMatch)
        {
            return(combos);
        }

        List <Block> blocks = new List <Block>
        {
            TrialLogic.placedBlocks[gridIndices],
            TrialLogic.placedBlocks[topRight],
            TrialLogic.placedBlocks[bottomLeft],
            TrialLogic.placedBlocks[bottomRight]
        };
        BlockCombo combo = new BlockCombo(blocks, blockComboType);

        combos.Add(combo);

        return(combos);
    }