Example #1
0
    bool IsCollide(BlockTeam bt, BT_Move_Type eBTMove = BT_Move_Type.BTM_None)
    {
        if (bt == null)
        {
            return(true);
        }
        Vector2Int vPos = bt.GetPos();
        int        iX   = vPos.x;
        int        iY   = vPos.y;

        switch (eBTMove)
        {
        case BT_Move_Type.BTM_Left:
            iX = vPos.x - 1;
            break;

        case BT_Move_Type.BTM_Right:
            iX = vPos.x + 1;
            break;

        case BT_Move_Type.BTM_Down:
            iY = vPos.y + 1;
            break;

        default:
            break;
        }
        for (int i = 0; i < bt.GetWidth(); i++)
        {
            for (int j = 0; j < bt.GetHeight(); j++)
            {
                int iBTValue, iWallValue;
                if (bt.GetValue(i, j, out iBTValue))
                {
                    if (iBTValue != 0)
                    {
                        if (GetValue(i + iX, j + iY, out iWallValue))
                        {
                            if (iWallValue != 0)
                            {
                                return(true);
                            }
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
                else
                {
                    return(true);
                }
            }
        }
        return(false);
    }
Example #2
0
    void Merge(BlockTeam bt)
    {
        Vector2Int vPos = bt.GetPos();

        for (int i = 0; i < bt.GetWidth(); i++)
        {
            for (int j = 0; j < bt.GetHeight(); j++)
            {
                int iBTValue;
                if (bt.GetValue(i, j, out iBTValue))
                {
                    if (iBTValue == 1)
                    {
                        SetValue(i + vPos.x, j + vPos.y, iBTValue);
                    }
                }
            }
        }
    }