示例#1
0
文件: Grid.cs 项目: Kauko/HnP
 public Critter[] GetSelection(int row, int col, int width, int height)
 {
     Critter[] selected = new Critter[width * height];
     int i = 0;
     for (int c = col; c < col + width; c++)
     {
         for (int r = row; r < row + height; r++)
         {
             if (grid[r, c] != null)
             {
                 selected[i] = grid[r, c];
                 grid[r, c] = null;
             }
             i++;
         }
     }
     return selected;
 }
示例#2
0
 public void RemovePlagued(Critter c)
 {
     string ct = c.GetType().Name;
     if (ct == "Female")
     {
         mFemales.Remove(c);
     }
     if (ct == "Doctor")
     {
         mDoctors.Remove(c);
     }
     if (ct == "Male")
     {
         mMales.Remove(c);
     }
 }
示例#3
0
文件: Grid.cs 项目: Kauko/HnP
 public void MoveCritters(Critter[] critters)
 {
     for (int i = 0; i < critters.Length; i++)
     {
         if (critters[i] != null)
         {
             Critter c = critters[i];
             grid[c.GetRow(), c.GetCol()] = c;
         }
     }
 }