Package com.csse3200.game.particles
Class ParticleService
java.lang.Object
com.csse3200.game.particles.ParticleService
Provides a global access point to create particle effects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum of the different types of particle effects that can be played. -
Constructor Summary
ConstructorsConstructorDescriptionInitialise the particle service and load particle effect assets. -
Method Summary
Modifier and TypeMethodDescriptionmakeEffect
(ParticleService.ParticleType type, int layer) Create a particle effect of a certain type.void
playEffect
(ParticleService.ParticleType type, com.badlogic.gdx.math.Vector2 position) Plays a particle effect to completion at a given x,y location.
-
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
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
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.
-