Exemple #1
0
        public Rigidbody CreateBody(RigidbodyProperties properties)
        {
            // Create graphic
            Shape bodyGraphic = graphicsManager.CreateShape(properties);

            // Create rigid body using graphic
            Rigidbody newBody;

            if (properties.BodyType == BodyType.Particle)
            {
                newBody = new Particle(bodyGraphic, (ParticleProperties)properties);
                particles.Add((Particle)newBody);
            }
            else
            {
                newBody = new Rigidbody(bodyGraphic, properties);
            }

            newBody.UID = bodyCounter;

            // Hook into the Delete event of the body to remove the body from this manager when it is deleted
            newBody.OnDelete += BodyDeleted;

            // Track body
            bodies.Add(newBody);

            bodyCounter++;

            return(newBody);
        }
Exemple #2
0
 public Rigidbody(Shape gShape, RigidbodyProperties properties) : base(gShape, properties)
 {
     BodyType = properties.BodyType;
     Charge   = properties.charge;
 }