コード例 #1
0
        public List <Vector2> GetFarseerVertices()
        {
            // create a list of vectors
            List <Vector2> vertices = new List <Vector2>();

            Vector2 a = Vector2.Zero;

            // the second vector is the first endpoint, which should take into account angle and range, where angle takes into account where the light is aimed
            Vector2 b = Engine.Physics.PositionToPhysicsWorld(new Vector2(Range / 1.5f, Range / 1.5f));

            b = XnaHelper.RotateVector2(b, Angle - MathHelper.PiOver2 + 0.17f, a);

            // the third vector is the second endpoint, which should take into account angle, range, and the light's "fov", or the light's interior angle
            Vector2 c = XnaHelper.RotateVector2(b, Fov, Vector2.Zero);

            vertices.Add(a);
            vertices.Add(b);
            vertices.Add(c);

            return(vertices);
        }
コード例 #2
0
        public List <Vector2> GetVertices()
        {
            // create a list of vectors
            List <Vector2> vertices = new List <Vector2>();

            // the first vector is the light's position
            Vector2 a = Position;

            // the second vector is the first endpoint, which should take into account angle and range, where angle takes into account where the light is aimed
            Vector2 b = Position + new Vector2(Range / 1.5f, Range / 1.5f);

            b = XnaHelper.RotateVector2(b, Angle - MathHelper.PiOver2 + 0.17f, a);

            // the third vector is the second endpoint, which should take into account angle, range, and the light's "fov", or the light's interior angle
            Vector2 c = XnaHelper.RotateVector2(b, Fov, a);

            vertices.Add(a);
            vertices.Add(b);
            vertices.Add(c);

            return(vertices);
        }