public void Remove(IPhysicsObject p, IForceGenerator forceGen) { List<IForceGenerator> list; if (registry.ContainsKey(p)) { list = registry[p]; list.Remove(forceGen); } }
public SpringSimulation() { mass = new Particle(); Vector Anchor = Vector.Zero(); double k = .1; double restLength = 0; forceGenerator = new AnchoredSpringGenerator(Anchor, k, restLength); }
public void Add(IPhysicsObject p, IForceGenerator forceGen) { List<IForceGenerator> list; if (registry.ContainsKey(p)) { list = registry[p]; } else { registry[p] = list = new List<IForceGenerator>(); } list.Add(forceGen); }
public void UpdateForceGenerators(IPhysicsObject p, GameTime gameTime) { if (registry.ContainsKey(p)) { int size = registry[p].Count; IForceGenerator[] list = new IForceGenerator[size]; registry[p].CopyTo(list, 0); for (int i = 0; i < size; i++) { list[i].updateForce(p, gameTime); } } }
/// <summary> /// Update semi-static potential field /// </summary> public void UpdateSemistaticPF() { semistaticPF.Clear(0); for (int i = semistaticGenerators.Count - 1; i >= 0; i--) { IForceGenerator gen = semistaticGenerators[i]; if (gen != null) { gen.GenerateForce(ref semistaticPF); } else { semistaticGenerators.RemoveAt(i); } } }
public void RemoveForceGenerator(IForceGenerator forceGenerator, Entity entity) { Monitor.Exit(ForceGeneratorRegistry); for (int i = 0; i < ForceGeneratorRegistry.Count; ) { var registration = ForceGeneratorRegistry[i]; if (registration.Item1 == forceGenerator && registration.Item2 == entity) { ForceGeneratorRegistry.Remove(registration); } else { i++; } } Monitor.Exit(ForceGeneratorRegistry); }
public void AddForceGenerator(IForceGenerator forceGenerator, Entity entity) { Monitor.Enter(ForceGeneratorRegistry); ForceGeneratorRegistry.Add(new Tuple<IForceGenerator, Entity>(forceGenerator, entity)); Monitor.Exit(ForceGeneratorRegistry); }
/// <summary> /// Remove a semi-static force generator /// </summary> /// <param name="generator">The force generator</param> public void RemoveSemistaticGenerator(IForceGenerator generator) { semistaticGenerators.Remove(generator); UpdateResultPF(); }
/// <summary> /// Add a semi-static force generator /// </summary> /// <param name="generator">A force generator</param> public void AddSemistaticGenerator(IForceGenerator generator) { semistaticGenerators.Add(generator); UpdateResultPF(); }
/// <summary> /// Add a force generator to the physics world. /// </summary> /// <param name="generator">The generator to add.</param> public void Add(IForceGenerator generator) { _generators.Add(generator); }
/// <summary> /// Remove a force generator from the physics world. /// </summary> /// <param name="generator">The generator to remove.</param> /// <returns>Returns a value indicating whether the generator was successfully removed.</returns> public bool Remove(IForceGenerator generator) { return _generators.Remove(generator); }
/// <summary> /// Remove a force generator from the physics world. /// </summary> /// <param name="generator">The generator to remove.</param> /// <returns>Returns a value indicating whether the generator was successfully removed.</returns> public bool Remove(IForceGenerator generator) { return(_generators.Remove(generator)); }
public void RemoveGlobalForceGenerator(IForceGenerator forceGenerator) { Monitor.Enter(GlobalForces); GlobalForces.Remove(forceGenerator); Monitor.Exit(GlobalForces); }
public ForceRegistration(IPhysicsObject component, IForceGenerator forceGenerator) { physicsComponent = component; fg = forceGenerator; }
/// <summary> /// Add a dynamic force generator /// </summary> /// <param name="generator">A force generator</param> public void AddDynamicGenerator(IForceGenerator generator) { dynamicGenerators.Add(generator); }
/// <summary> /// removes the force. Requrires pointer to force. This function is temporary. /// </summary> /// <param name="force"></param> public void deleteForce(IForceGenerator force) { forceGens.Remove(force); }
public void addForce(IForceGenerator force) { forceGens.Add(force); }
/// <summary> /// Add a dynamic force generator /// </summary> /// <param name="generator">The force generator</param> public void RemoveDynamicGenerator(IForceGenerator generator) { dynamicGenerators.Remove(generator); }
public ForceRegistration() { physicsComponent = null; fg = null; }
public void AddGlobalForceGenerator(IForceGenerator forceGenerator) { Monitor.Enter(GlobalForces); GlobalForces.Add(forceGenerator); Monitor.Exit(GlobalForces); }
/// <summary> /// Remove the force generator from the specified object /// </summary> /// <param name="component">Componen on which remove the force generator</param> /// <param name="forceGenerator">Force generator to remove</param> public void Remove(IPhysicsObject component, IForceGenerator forceGenerator) { registrations.Remove(new ForceRegistration(component, forceGenerator)); }
/// <summary> /// Add a force generator to the physics world. /// </summary> /// <param name="generator">The generator to add.</param> public void Add(IForceGenerator generator) { _generators.Add(generator); }