Class ParticleService

java.lang.Object
com.csse3200.game.particles.ParticleService

public class ParticleService extends Object
Provides a global access point to create particle effects.
  • Constructor Details

    • ParticleService

      public ParticleService()
      Initialise the particle service and load particle effect assets. Requires the resource service to be registered in the service locator. All particle effects are scaled by 0.02f so they can be a reasonable size in the particle effect editor.
  • Method Details

    • makeEffect

      public ParticleEffectRenderer makeEffect(ParticleService.ParticleType type, int layer)
      Create a particle effect of a certain type. The created particle effect must be freed when it is no longer used by using the freeEffect function. Calls the effect start() function.
      Parameters:
      type - the type of particle effect to make.
      layer - the render layer to make the particle.
      Returns:
      reference to the created particle effect.
    • playEffect

      public void playEffect(ParticleService.ParticleType type, com.badlogic.gdx.math.Vector2 position)
      Plays a particle effect to completion at a given x,y location. Rendering and freeing the particle effect is handled by the particle service. Requires the render service to be registered in the service locator. Initialises the ParticleEffectRenderer to display above entities.
      Parameters:
      type - the type of particle effect to play.
      position - the world position of the particle effect.