Exemplo n.º 1
0
        static public int RemoveFullRows(RemoveCallBack remove, DropCallBack drop)
        {
            int dropRows = 0;

            for (int y = 0; y <= TopRow; y++)
            {
                bool full = true;
                for (int x = 0; x < Width; x++)
                {
                    if (Grid[LinearPosition(x, y)] == Entity.Null)
                    {
                        full = false;
                        break;
                    }
                }
                if (full)
                {
                    dropRows++;
                    for (int x = 0; x < Width; x++)
                    {
                        remove(Grid[LinearPosition(x, y)]);
                        Grid[LinearPosition(x, y)] = Entity.Null;
                    }
                }
                else if (dropRows > 0)
                {
                    for (int x = 0; x < Width; x++)
                    {
                        int lpos = LinearPosition(x, y);
                        if (Grid[lpos] != Entity.Null)
                        {
                            drop(Grid[lpos], dropRows);
                            Grid[LinearPosition(x, y - dropRows)] = Grid[lpos];
                            Grid[lpos] = Entity.Null;
                        }
                    }
                }
            }
            if (dropRows > 0)
            {
                TopRow             -= dropRows;
                CurrentScore       += dropRows;
                Instance.Score.text = CurrentScore.ToString();
            }
            return(dropRows);
        }
Exemplo n.º 2
0
 public new void Remove()
 {
     if (TreeView != null && TreeView.InvokeRequired) {
     RemoveCallBack d = new RemoveCallBack(Remove);
     TreeView.Invoke(d, new object[] { });
       } else {
     foreach (ExecutionNode child in Nodes) {
       child.Remove();
     }
     Nodes.Remove(this);
     parent = null;
       }
 }