Exemple #1
0
    public void CheckBoomAftermath()
    {
        for (int y = (mapModel.LengthY - 1); y >= 0; --y)
        {
            for (int x = 0; x < mapModel.LengthX; ++x)
            {
                if (!mapModel.CheckShowBlock(y, x))
                {
                    continue;
                }

                int  directionIndex  = (x % 2);
                bool isBoomAftermath = false;
                for (int j = 0; j < mapModel.DirectionLengthY; ++j)
                {
                    if (!mapModel.CheckQuestBlock(y, x))
                    {
                        continue;
                    }

                    for (int k = 0; k < mapModel.DirectionLengthX; ++k)
                    {
                        Vector2Int direction = mapModel.GetDirection(directionIndex, j, k);
                        int        nextY     = y + direction.y;
                        int        nextX     = x + direction.x;

                        if (mapModel.CheckRangeOver(nextY, nextX))
                        {
                            continue;
                        }

                        Block nectBlock = mapModel.GetBlock(nextY, nextX);
                        if (!nectBlock.IsShow)
                        {
                            continue;
                        }

                        if (nectBlock.IsQuestBlock)
                        {
                            continue;
                        }

                        if (nectBlock.IsBoom)
                        {
                            isBoomAftermath = true;
                            break;
                        }
                    }

                    if (isBoomAftermath)
                    {
                        mapModel.SetQuestCountMinus(y, x);
                        break;
                    }
                }
            }
        }
    }