Пример #1
0
 void AddGlObject(Body obj)
 {
     lock (objects)
     {
         OpenGlObject o = new OpenGlObject(obj);
         obj.Tag = o;
         objects.Add(o);
     }
 }
Пример #2
0
 void AddGlObjectRange(IList<Body> collection)
 {
     OpenGlObject[] arr = new OpenGlObject[collection.Count];
     for (int index = 0; index < arr.Length; ++index)
     {
         arr[index] = new OpenGlObject(collection[index]);
         collection[index].Tag = arr[index];
     }
     lock (objects)
     {
         objects.AddRange(arr);
     }
 }
Пример #3
0
        void AddRays()
        {
            List<RaySegment> segments = new List<RaySegment>();


            for (Scalar angle = 0; angle < MathHelper.PiOver2; angle += .05f)
            {
                RaySegment seg = new RaySegment();
                seg.Length = 500;
                seg.RayInstance = new Ray(Vector2D.Zero, Vector2D.FromLengthAndAngle(1, angle));
                segments.Add(seg);
            }

            lazer = new Body(new PhysicsState(), new RaySegmentsShape(segments.ToArray()), 1, new Coefficients(1, 1), new Lifespan());
            lazer.State.Position.Linear = sparkPoint;
            lazer.State.Velocity.Angular = .91f;
            lazer.IgnoresGravity = true;
            lazer.ApplyPosition();
            engine.AddBody(lazer);
            lazerLogic = new RaySegmentsCollisionLogic(lazer);
            engine.AddLogic(lazerLogic);
            lock (objects)
            {
                OpenGlObject o = new OpenGlObject(lazer, lazerLogic);
                lazer.Tag = o;
                objects.Add(o);
            }
        }