Esempio n. 1
0
            public static Walls CreateRandomWalls(Device dx_device, int cnt, float minx, float maxx, float miny, float maxy)
            {
                Walls ret = new Walls();
                Random rand = new Random();

                Vector2[] boundary = new Vector2[4] {
                    new Vector2(minx,miny),
                    new Vector2(minx,maxy),
                    new Vector2(maxx,miny),
                    new Vector2(maxx,maxy),
                };
                for (int i = 0; i < cnt; i++)
                {
                    Vector2 p1, p2;
                    p1.X = (float)rand.NextDouble() * (maxx - minx) + minx;
                    p1.Y = (float)rand.NextDouble() * (maxy - miny) + miny;
                    p2.X = (float)rand.NextDouble() * (maxx - minx) + minx;
                    p2.Y = (float)rand.NextDouble() * (maxy - miny) + miny;
                    ret.AddWall(dx_device, p1, p2, boundary);
                }

                return ret;
            }