bool MoveCharacterInGrid(CharacterIF c, int x, int y) { var pos = FindCharacterInGrid(c); if (pos.Item1 != -1) { if (x + c.GetLength() < gridLength && y + c.GetWidth() < gridWidth) { for (int i = 0; i < c.GetWidth(); i++) { for (int j = 0; j < c.GetLength(); j++) { if (grid[x + i, y + j] != null) { //reserves.send(character); } grid[pos.Item1 + i, pos.Item2 + j] = null; } } } } return(false); }
bool AddCharacterToGrid(CharacterIF c, int x, int y) { for (int i = 0; i < c.GetWidth(); i++) { for (int j = 0; j < c.GetLength(); j++) { if (grid[x + i, y + j] != null) { return(false); } } } for (int i = 0; i < c.GetWidth(); i++) { for (int j = 0; j < c.GetLength(); j++) { grid[x + i, y + j] = c; } } return(true); }