GetUserData() public méthode

Get the user data pointer that was provided in the body definition.
public GetUserData ( ) : object
Résultat object
            public override void Violation(Body body)
            {
                PhysicsObject obj = body.GetUserData() as PhysicsObject;

                // code to fill up a hole
                int fillradius = 3;
                if (obj is PaintedObject)
                {
                    foreach (PhysicsObject hole in this.world.Objects)
                    {
                        if (hole is HoleObject && obj.Position.X < hole.Position.X + fillradius && obj.Position.X > hole.Position.X - fillradius )
                        {
                            ((HoleObject)hole).Filled += ((PaintedObject)obj).Length;
                            //Console.WriteLine("Filled: "); Console.WriteLine(((HoleObject)hole).Filled); // DEBUG
                        }
                    }
                }

                // code to kill the object that fell off, and to fail you if that object was you
                obj.Die();
                if (obj == world.dude)
                    world.Fail();
            }