示例#1
0
 void FixedUpdate()
 {
     Constants.SetConstants(compute, Time.fixedDeltaTime);
     VelSimulation.Simulate();
     Broadphase.FindBand(2f * constants.radius);
     for (var i = 0; i < 4; i++)
     {
         ParticleSolver.Solve();
         WallSolver.Solve();
         Velocities.ClampMagnitude();
     }
     PosSimulation.Simulate();
     BoundsChecker.Check();
     Lifes.Simulate();
 }
示例#2
0
 void OnDestroy()
 {
     if (Positions != null)
     {
         Positions.Dispose();
     }
     if (Velocities != null)
     {
         Velocities.Dispose();
     }
     if (Lifes != null)
     {
         Lifes.Dispose();
     }
     if (Constants != null)
     {
         Constants.Dispose();
     }
     if (Walls != null)
     {
         Walls.Dispose();
     }
     if (VelSimulation != null)
     {
         VelSimulation.Dispose();
     }
     if (PosSimulation != null)
     {
         PosSimulation.Dispose();
     }
     if (Broadphase != null)
     {
         Broadphase.Dispose();
     }
     if (WallSolver != null)
     {
         WallSolver.Dispose();
     }
     if (ParticleSolver != null)
     {
         ParticleSolver.Dispose();
     }
     if (Combiner != null)
     {
         Combiner.Dispose();
     }
 }
示例#3
0
 void OnDestroy()
 {
     if (Positions != null)
     {
         Positions.Dispose();
     }
     if (Velocities != null)
     {
         Velocities.Dispose();
     }
     if (Lifes != null)
     {
         Lifes.Dispose();
     }
     if (Constants != null)
     {
         Constants.Dispose();
     }
     if (Polygons != null)
     {
         Polygons.Dispose();
     }
     if (VelSimulation != null)
     {
         VelSimulation.Dispose();
     }
     if (PosSimulation != null)
     {
         PosSimulation.Dispose();
     }
     if (Collisions != null)
     {
         Collisions.Dispose();
     }
     if (PolygonSolver != null)
     {
         PolygonSolver.Dispose();
     }
     if (ParticleSolver != null)
     {
         ParticleSolver.Dispose();
     }
     if (Combiner != null)
     {
         Combiner.Dispose();
     }
 }
示例#4
0
 void FixedUpdate()
 {
     Constants.SetConstants(compute, constants.FixedDeltaTime);
     VelSimulation.Simulate();
     if (particleCollisionEnabled)
     {
         Collisions.Detect(2f * constants.radius);
     }
     for (var i = 0; i < 10; i++)
     {
         PolygonSolver.Solve();
         if (particleCollisionEnabled)
         {
             ParticleSolver.Solve();
         }
         Velocities.ClampMagnitude();
     }
     PosSimulation.Simulate();
     BoundsChecker.Check();
     Lifes.Simulate();
 }