示例#1
0
 /// <summary>
 /// Creates a gravity controller and adds it to the physics simulator.
 /// </summary>
 /// <param name="simulator">the physicsSimulator used by this controller.</param>
 /// <param name="points">The points you want to generate gravity.</param>
 /// <param name="strength">the maximum strength of gravity (the gravity strength when two bodies are on the same spot)</param>
 /// <param name="radius">the maximum distance that can be between 2 bodies before it will stop trying to apply gravity between them.</param>
 /// <returns></returns>
 public GravityController CreateGravityController(PhysicsSimulator simulator, List<Vector2> points, float strength, float radius)
 {
     GravityController gravityController = new GravityController(simulator, points, strength, radius);
     simulator.Add(gravityController);
     return gravityController;
 }
示例#2
0
 /// <summary>
 /// Creates a gravity controller and adds it to the physics simulator.
 /// </summary>
 /// <param name="simulator">the physicsSimulator used by this controller.</param>
 /// <param name="bodies">The bodies you want to generate gravity.</param>
 /// <param name="strength">the maximum strength of gravity (the gravity strength when two bodies are on the same spot)</param>
 /// <param name="radius">the maximum distance that can be between 2 bodies before it will stop trying to apply gravity between them.</param>
 /// <returns></returns>
 public GravityController CreateGravityController(PhysicsSimulator simulator, List<Body> bodies, float strength, float radius)
 {
     GravityController gravityController = new GravityController(simulator, bodies, strength, radius);
     simulator.Add(gravityController);
     return gravityController;
 }