Beispiel #1
0
        public void GenerateColliders(Canvas canvas)
        {
            double left, right, top, bottom, width, height;
            var    coords = new double[N, 2] {
                { 100, 100 }, { 350, 100 }, { 100, 350 }, { 350, 350 }
            };

            for (int i = 0; i < rand.Next(4) + 2; i++)
            {
                width  = rand.Next(150) + 50;
                height = rand.Next(150) + 50;
                right  = bottom = 0;
                left   = rand.Next(50) + coords[i % 4, 0];
                top    = rand.Next(50) + coords[i % 4, 1];
                var extendedRectangle = new ExtendedRectangle(width, height, left, top, right, bottom);
                extendedRectangle.rectangle.Fill = Brushes.Red;
                Colliders.Add(extendedRectangle);
                canvas.Children.Add(extendedRectangle.rectangle);
            }
        }
Beispiel #2
0
 public void GenerateColliders(Canvas canvas)
 {
     double left, right, top, bottom, width, height;
     var coords = new double[N, 2] { { 100, 100 }, { 350, 100 }, { 100, 350 }, { 350, 350 } };
     for (int i = 0; i < rand.Next(4) + 2; i++)
     {
         width = rand.Next(150) + 50;
         height = rand.Next(150) + 50;
         right = bottom = 0;
         left = rand.Next(50) + coords[i%4, 0];
         top = rand.Next(50) + coords[i%4, 1];
         var extendedRectangle = new ExtendedRectangle(width, height, left, top, right, bottom);
         extendedRectangle.rectangle.Fill = Brushes.Red;
         Colliders.Add(extendedRectangle);
         canvas.Children.Add(extendedRectangle.rectangle);
     }
 }