예제 #1
0
 public List<Visual> PickSurfaces(double x, double y, double w, double h)
 {
     List<Visual> picks = new List<Visual>();
     Physics.Primitives.RectangleParticle particle = new Physics.Primitives.RectangleParticle(x, y, w, h);
     foreach (Visual visual in visuals)
     {
         if (visual.source is Physics.Surfaces.ISurface)
         {
             Physics.Surfaces.AbstractSurface surface = visual.source as Physics.Surfaces.AbstractSurface;
             if (surface.TestBoundingBox(x, y, x+w, y+h)) picks.Add(visual);
         }
     }
     return picks;
 }
예제 #2
0
 public Visual PickSurface(double x, double y)
 {
     Physics.Primitives.RectangleParticle particle = new Physics.Primitives.RectangleParticle(x, y, 2, 2);
     foreach (Visual visual in visuals)
     {
         if (visual.source is Physics.Surfaces.ISurface)
         {
             Physics.Surfaces.ISurface surface = visual.source as Physics.Surfaces.ISurface;
             if (surface.IsRectangleColliding(particle)) return visual;
         }
     }
     return null;
 }