示例#1
0
    public bool IsGameOver()
    {
        if (Grids.items.Where(g => g.isEmpty).Count() == 0)
        {
            for (var i = 0; i < Grids.count; i++)
            {
                if (Grids.HasLeft(i) && Grids.GetLeft(i).num == Grids.GetItem(i).num)
                {
                    return(false);
                }
                if (Grids.HasRight(i) && Grids.GetRight(i).num == Grids.GetItem(i).num)
                {
                    return(false);
                }
                if (Grids.HasUp(i) && Grids.GetUp(i).num == Grids.GetItem(i).num)
                {
                    return(false);
                }
                if (Grids.HasDown(i) && Grids.GetDown(i).num == Grids.GetItem(i).num)
                {
                    return(false);
                }
            }

            return(true);
        }
        return(false);
    }