Exemple #1
0
    private void SetUFOBlocksBoom(Block moveBlock, Block targetBlock)
    {
        mapModel.SetBoomFlag(moveBlock.Y, moveBlock.X, isBoom: true);

        int count    = 0;
        int maxCount = 6;

        for (int y = (mapModel.LengthY - 1); y >= 0; --y)
        {
            for (int x = 0; x < mapModel.LengthX; ++x)
            {
                if (!mapModel.CheckShowBlock(y, x))
                {
                    continue;
                }
                if (mapModel.CheckFixedBlock(y, x))
                {
                    continue;
                }
                if (mapModel.CheckQuestBlock(y, x))
                {
                    continue;
                }
                if (mapModel.CheckEmptyBlock(y, x))
                {
                    continue;
                }
                if (y == moveBlock.Y && x == moveBlock.X)
                {
                    continue;
                }

                if (targetBlock.ItemType == ItemType.None &&
                    targetBlock.BlockType == mapModel.GetBlockType(y, x))
                {
                    mapModel.SetBoomFlag(y, x, isBoom: true);
                    count++;
                }
                else if (targetBlock.ItemType > ItemType.None &&
                         targetBlock.BlockType == mapModel.GetBlockType(y, x) &&
                         !mapModel.CheckBoomBlock(y, x))
                {
                    mapModel.SetItemType(y, x, targetBlock.ItemType);
                    mapModel.SetBoomFlag(y, x, isBoom: true);
                    count++;
                }

                if (count == maxCount)
                {
                    break;
                }
            }
        }
    }
Exemple #2
0
    private void BoomBlockUnits()
    {
        int index = 0;

        for (int y = 0; y < mapModel.LengthY; ++y)
        {
            for (int x = 0; x < mapModel.LengthX; ++x)
            {
                if (mapModel.CheckBoomBlock(y, x))
                {
                    mapModel.SetBlockType(y, x, BlockType.Empty);
                    hexaBlockUnits[index].Boom();
                }

                index++;
            }
        }
    }