예제 #1
0
 /// <summary>
 /// Removes the mobile from the internal management list.
 /// </summary>
 public void Remove(Mobile mobile)
 {
     mobiles.Remove(mobile);
 }
        /// <summary>
        /// Renders out a single mobile.
        /// </summary>
        private void Render(Mobile mobile)
        {
            // Render a circle of the appropriate location with the
            // proper color and shape.
            PointF cp = ToPoint(mobile.Point.X, mobile.Point.Y);

            Paint.FilledCircle(cp.X, cp.Y,
                mobile.Radius * ViewState.Scale,
                mobile.Color);

            Paint.Circle(cp.X, cp.Y,
                mobile.Radius * ViewState.Scale,
                Color.Black);

            // See if we are in the physics
            /* DEBUGGING
            RenderPolygon((PolygonShape) mobile.PhysicsBody.Shape,
                mobile.Point,
                mobile.PhysicsBody.State.Position.Angular);
            */
        }
예제 #3
0
        /// <summary>
        /// Adds a mobile object into the physics world.
        /// </summary>
        public void Add(Mobile mobile)
        {
            // See if we already have it
            if (mobile == null || mobiles.Contains(mobile))
                return;

            // Add this mobile to the engine
            Log.Debug("Adding mobile: {0}", mobile);
            engine.AddBody(mobile.PhysicsBody);
            mobiles.Add(mobile);
        }