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(); } } }
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); } }
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); } }
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; } } } } } }
public virtual bool CheckAction(GameboardCell c) { // Default is do nothing return(false); }