//Removes wall between adjacent cell (sets wall values to false) //Output: bool: returns true if all removed // increments wallRemoved //Output: bool: returns false if no wall removed //Input: cell: the adjacent cell public override bool RemoveWall(cell iOther) { if (iOther != null && typeof(hexCell) == iOther.GetType()) { //the other grid ref is to the... bool above = Y > iOther.Y; bool below = Y < iOther.Y; bool left = X > iOther.X; bool right = X < iOther.X; if (Y % 2 == 1) // odd row { if (left) { if (this.Walls [3] || iOther.Walls [0]) { this.Walls [3] = false; iOther.Walls [0] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } else if (right) { if (above) { if (this.Walls [5] || iOther.Walls [2]) { this.Walls [5] = false; iOther.Walls [2] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } else if (below) { if (this.Walls [1] || iOther.Walls [4]) { this.Walls [1] = false; iOther.Walls [4] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } else { if (this.Walls [0] || iOther.Walls [3]) { this.Walls [0] = false; iOther.Walls [3] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } } else { if (above) { if (this.Walls [4] || iOther.Walls [1]) { this.Walls [4] = false; iOther.Walls [1] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } else if (below) { if (this.Walls [2] || iOther.Walls [5]) { this.Walls [2] = false; iOther.Walls [5] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } } } else //even row { if (left) { if (above) { if (this.Walls [4] || iOther.Walls [1]) { this.Walls [4] = false; iOther.Walls [1] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } else if (below) { if (this.Walls [2] || iOther.Walls [5]) { this.Walls [2] = false; iOther.Walls [5] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } else { if (this.Walls [3] || iOther.Walls [0]) { this.Walls [3] = false; iOther.Walls [0] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } } else if (right) { if (this.Walls [0] || iOther.Walls [3]) { this.Walls [0] = false; iOther.Walls [3] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } else { if (above) { if (this.Walls [5] || iOther.Walls [2]) { this.Walls [5] = false; iOther.Walls [2] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } else if (below) { if (this.Walls [1] || iOther.Walls [4]) { this.Walls [1] = false; iOther.Walls [4] = false; this.WallsRemoved++; iOther.WallsRemoved++; return(true); } } } } } return(false); }