Exemple #1
0
 public Gameboard(int ys, int xs)
 {
     xSize = xs;
     ySize = ys;
     grid  = new GameboardCell[ySize, xSize];
     for (int y = 0; y < ySize; y++)
     {
         for (int x = 0; x < xSize; x++)
         {
             grid[y, x] = new GameboardCell();
         }
     }
 }
Exemple #2
0
        public override bool CheckAction(GameboardCell c)
        {
            Thief ti = (Thief)c.People.Find(i => i is Thief);

            if (ti != null)
            {
                DoAction(ti);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        public override bool CheckAction(GameboardCell c)
        {
            Citizen ci = (Citizen)c.People.Find(i => i is Citizen);

            if (ci != null)
            {
                DoAction(ci);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
 public void CheckForCollitions()
 {
     for (int y = 0; y < ySize; y++)
     {
         for (int x = 0; x < xSize; x++)
         {
             if (grid[y, x].People.Count > 1)
             {
                 GameboardCell cell = GetCell(y, x);
                 foreach (Person person in cell.People)
                 {
                     // If CheckAction() returns true that means an action was executed and we should go out of this loop
                     if (person.CheckAction(cell))
                     {
                         break;
                     }
                 }
             }
         }
     }
 }
Exemple #5
0
 public virtual bool CheckAction(GameboardCell c)
 {
     // Default is do nothing
     return(false);
 }