Beispiel #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            _boundaries = new List<Boundary>();

            _width = GraphicsDevice.Viewport.Width / 2;
            _height = GraphicsDevice.Viewport.Height;

            _boundaries.Add(new Boundary(Vector2.Zero, new Vector2(_width, 0)));
            _boundaries.Add(new Boundary(Vector2.Zero, new Vector2(0, _height)));
            _boundaries.Add(new Boundary(new Vector2(_width, 0), new Vector2(_width, _height)));
            _boundaries.Add(new Boundary(new Vector2(0, _height), new Vector2(_width, _height)));
            /*
            Random rnd = new Random();
            for (int i = 0; i < 7; i++)
            {
                int x1 = (int)(rnd.NextDouble() * _width);
                int y1 = (int)(rnd.NextDouble() * _height);
                int x2 = (int)(rnd.NextDouble() * _width);
                int y2 = (int)(rnd.NextDouble() * _height);
                int red = (int)(rnd.NextDouble() * 255);
                int green = (int)(rnd.NextDouble() * 255);
                int blue = (int)(rnd.NextDouble() * 255);
                _boundaries.Add(new Boundary(new Vector2(x1, y1), new Vector2(x2, y2)) { Color = new Color(red, green, blue) });
            }
            */
            _boundaries.Add(new Boundary(new Vector2(100, 100), new Vector2(150, 100)));
            _boundaries.Add(new Boundary(new Vector2(100, 100), new Vector2(100, 150)));
            _boundaries.Add(new Boundary(new Vector2(150, 100), new Vector2(100, 150)));
            //_rayViewer = new RayViewer(new Vector2(100, 200), 0, 360, 0.1f, Color.White, .03f)
            _rayViewer = new RayViewer(new Vector2(100, 200), 0, 1, 1f, Color.Red, 1f)
            {
                Draw3D = true,
                Area3D = new Rectangle(_width, 0, _width, _height)
            };
        }
Beispiel #2
0
 public Ray(RayViewer pParent, Vector2 pPosition, float pAngle)
 {
     Parent    = pParent;
     Position  = pPosition;
     Direction = new Vector2((float)Math.Cos(pAngle) * 10, (float)Math.Sin(pAngle) * 10);
 }
Beispiel #3
0
 public Ray(RayViewer pParent, Vector2 pPosition)
 {
     Parent   = pParent;
     Position = pPosition;
 }