public Field NextField(directionID direction) { if (direction == directionID.NE) { return(NE); } if (direction == directionID.EA) { return(EA); } if (direction == directionID.SE) { return(SE); } if (direction == directionID.SW) { return(SW); } if (direction == directionID.WE) { return(WE); } if (direction == directionID.NW) { return(NW); } else { return(null); } }
public Field GetNeighbour(directionID dir) { if (dir == directionID.NE) { return((NE != null) ? NE: null); } if (dir == directionID.EA) { return((EA != null) ? EA : null); } if (dir == directionID.SE) { return((SE != null) ? SE : null); } if (dir == directionID.SW) { return((SW != null) ? SW : null); } if (dir == directionID.WE) { return((WE != null) ? WE : null); } if (dir == directionID.NW) { return((NW != null) ? NW : null); } else { throw new ArgumentException("Direction id not supported : " + dir.ToString()); } }