// we assume the boulder is a rectangle public bool IsOverlapWithAnotherBoulder(Boulder anotherBoulder) { bool isWidthCoincide = !((anotherBoulder.largeX < this.smallX) || (this.largeX < anotherBoulder.smallX)); bool isHeightCoincide = !((anotherBoulder.largeY < this.smallY) || (this.largeY < anotherBoulder.smallY)); return(isWidthCoincide && isHeightCoincide); }
public void DeselectRock() { if (SelectedRock != null) { SelectedRock = null; // this causes selectedRockIndicator to be removed from the canvas in the setter } }
public Boulder AddRock(CameraSpacePoint camSpacePt, Point canvasPt, double rockWidth, double rockHeight) { SelectedRock = new Boulder(camSpacePt, canvasPt, rockWidth, rockHeight, canvas); rocksOnWall.Add(SelectedRock); SelectedRock.DrawBoulder(); return(SelectedRock); }
public Boulder GetRockInListByCanvasPoint(Point canvasPt) { Boulder requiredBoulder = null; foreach (Boulder rockOnWall in rocksOnWall) { if (rockOnWall.IsCoincideWithCanvasPoint(canvasPt)) { requiredBoulder = rockOnWall; break; } } return(requiredBoulder); }
public void RemoveRock(Boulder rock) { rocksOnWall.Remove(rock); rock.UndrawBoulder(); }
public void RemoveRock(Point canvasPt) { Boulder rockToBeRemoved = GetRockInListByCanvasPoint(canvasPt); RemoveRock(rockToBeRemoved); }