private bool IsValidCell(Vector2I cell) { if (cell.X < 0 || cell.X >= width || cell.Y < 0 || cell.Y >= height) { return false; } return true; }
private Vector2I GetNeighbourIndex(Directions direction, int posX, int posY) { Vector2I neighbour = new Vector2I(posX, posY); switch (direction) { case Directions.North: neighbour.Y--; break; case Directions.NorthEast: neighbour.X++; neighbour.Y--; break; case Directions.East: neighbour.X++; break; case Directions.SouthEast: neighbour.X++; neighbour.Y++; break; case Directions.South: neighbour.Y++; break; case Directions.SouthWest: neighbour.X--; neighbour.Y++; break; case Directions.West: neighbour.X--; break; case Directions.NorthWest: neighbour.X--; neighbour.Y--; break; } return neighbour; }