public override void initTest(bool deserialized) { { { PolygonShape shape = new PolygonShape(); Vec2[] vertices = new Vec2[] {new Vec2(-40, -20), new Vec2(40, -20), new Vec2(40, 0), new Vec2(-40, 0)}; shape.set(vertices, 4); getGroundBody().createFixture(shape, 0.0f); } { PolygonShape shape = new PolygonShape(); Vec2[] vertices = new Vec2[] { new Vec2(-40, -20), new Vec2(-20, -20), new Vec2(-20, 60), new Vec2(-40, 60) }; shape.set(vertices, 4); getGroundBody().createFixture(shape, 0.0f); } { PolygonShape shape = new PolygonShape(); Vec2[] vertices = new Vec2[] {new Vec2(20, -20), new Vec2(40, -20), new Vec2(40, 60), new Vec2(20, 60)}; shape.set(vertices, 4); getGroundBody().createFixture(shape, 0.0f); } { PolygonShape shape = new PolygonShape(); Vec2[] vertices = new Vec2[] {new Vec2(-40, 40), new Vec2(40, 40), new Vec2(40, 60), new Vec2(-40, 60)}; shape.set(vertices, 4); getGroundBody().createFixture(shape, 0.0f); } } m_world.setParticleRadius(0.5f); m_lastGroup = null; m_drawing = true; m_groupFlags = 0; }
public void sayGoodbye(ParticleGroup group) { particleGroupDestroyed(group); }
public virtual void particleGroupDestroyed(ParticleGroup group) { }
/** * Destroy particles in a group without enabling the destruction callback for destroyed particles. * This function is locked during callbacks. * * @param The particle group to destroy. * @warning This function is locked during callbacks. */ public void destroyParticlesInGroup(ParticleGroup group) { destroyParticlesInGroup(group, false); }
/** * Destroy particles in a group. This function is locked during callbacks. * * @param The particle group to destroy. * @param Whether to call the world b2DestructionListener for each particle is destroyed. * @warning This function is locked during callbacks. */ public void destroyParticlesInGroup(ParticleGroup group, bool callDestructionListener) { Debug.Assert(isLocked() == false); if (isLocked()) { return; } m_particleSystem.destroyParticlesInGroup(group, callDestructionListener); }
/** * Join two particle groups. * * @param the first group. Expands to encompass the second group. * @param the second group. It is destroyed. * @warning This function is locked during callbacks. */ public void joinParticleGroups(ParticleGroup groupA, ParticleGroup groupB) { Debug.Assert(isLocked() == false); if (isLocked()) { return; } m_particleSystem.joinParticleGroups(groupA, groupB); }
public override void particleGroupDestroyed(ParticleGroup group) { base.particleGroupDestroyed(group); if (group == m_lastGroup) { m_lastGroup = null; } }
public override void mouseUp(Vec2 p, int button) { base.mouseUp(p, button); m_lastGroup = null; }
public override void mouseDrag(Vec2 p, int button) { base.mouseDrag(p, button); if (m_drawing) { pshape.m_p.set(p); pshape.m_radius = 2.0f; pxf.setIdentity(); m_world.destroyParticlesInShape(pshape, pxf); ppd.shape = pshape; ppd.color = color; ppd.flags = m_particleFlags; ppd.groupFlags = m_groupFlags; ParticleGroup group = m_world.createParticleGroup(ppd); if (m_lastGroup != null && group.getGroupFlags() == m_lastGroup.getGroupFlags()) { m_world.joinParticleGroups(m_lastGroup, group); } else { m_lastGroup = group; } mouseTracing = false; } }