Ejemplo n.º 1
0
        // 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);
        }
Ejemplo n.º 2
0
 public void DeselectRock()
 {
     if (SelectedRock != null)
     {
         SelectedRock = null;  // this causes selectedRockIndicator to be removed from the canvas in the setter
     }
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
        public Boulder GetRockInListByCanvasPoint(Point canvasPt)
        {
            Boulder requiredBoulder = null;

            foreach (Boulder rockOnWall in rocksOnWall)
            {
                if (rockOnWall.IsCoincideWithCanvasPoint(canvasPt))
                {
                    requiredBoulder = rockOnWall;
                    break;
                }
            }

            return(requiredBoulder);
        }
Ejemplo n.º 5
0
 public void RemoveRock(Boulder rock)
 {
     rocksOnWall.Remove(rock);
     rock.UndrawBoulder();
 }
Ejemplo n.º 6
0
        public void RemoveRock(Point canvasPt)
        {
            Boulder rockToBeRemoved = GetRockInListByCanvasPoint(canvasPt);

            RemoveRock(rockToBeRemoved);
        }