public static WallHide CreateRandomWalls(Device dx_device, int cnt, float minx, float maxx, float miny, float maxy) { WallHide ret = new WallHide(dx_device); 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(p1, p2); ret.m_shadow.AddWall(p1, p2); } return ret; }
public static void test(Device dx_device) { WallHide wh = new WallHide(dx_device); wh.AddWall(new Vector2(0, 0), new Vector2(5, 5)); wh.AddWall(new Vector2(0, 5), new Vector2(5, 0)); wh.AddWall(new Vector2(0, 0), new Vector2(5, 0)); wh.AddWall(new Vector2(0, 5), new Vector2(5, 5)); wh.AddWall(new Vector2(2.5f, 0), new Vector2(2.5f, 5)); }