Class ProjectileFactory
java.lang.Object
com.csse3200.game.entities.factories.ProjectileFactory
Factory to projectile entities with predefined components.
Each projectile entity type should have a creation method that returns a corresponding entity. Predefined entity properties can be loaded from the config classes
If needed, this factory can be separated into more specific factories for projectiles with similar characteristics.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ActiveProjectile
createArcProjectile
(ProjectileTarget target, WeaponsStatsComponent source, String texturePath, float gravityStrength) Base class to create a projectile.static Entity
createBomb
(ProjectileTarget target, WeaponsStatsComponent source, String texturePath) static Entity
createEnemyLaserProjectile
(com.badlogic.gdx.math.Vector2 direction, WeaponsStatsComponent source) Creates a standard laser shot entity projectilestatic ActiveProjectile
createFollowingProjectile
(ProjectileTarget target, WeaponsStatsComponent source, String texturePath, Entity targetEntity, float speed) Base class to create a projectile.static Entity
Creates a pistol bullet entitystatic Entity
createProjectile
(ProjectileTarget target, WeaponsStatsComponent source, String texturePath) Base class to create a projectile.
-
Method Details
-
createProjectile
public static Entity createProjectile(ProjectileTarget target, WeaponsStatsComponent source, String texturePath) Base class to create a projectile.- Parameters:
target
- The physics layer the projectile can collide withsource
- The stats of the weapon that shot the projectile.texturePath
- The texture of the projectile- Returns:
- An entity for the projectile
-
createArcProjectile
public static ActiveProjectile createArcProjectile(ProjectileTarget target, WeaponsStatsComponent source, String texturePath, float gravityStrength) Base class to create a projectile.- Parameters:
target
- The physics layer the projectile can collide withsource
- The stats of the weapon that shot the projectile.texturePath
- The texture of the projectilegravityStrength
- The strength of gravity affecting the projectile during its lifetime.- Returns:
- An entity for the projectile
-
createFollowingProjectile
public static ActiveProjectile createFollowingProjectile(ProjectileTarget target, WeaponsStatsComponent source, String texturePath, Entity targetEntity, float speed) Base class to create a projectile.- Parameters:
target
- The physics layer the projectile can collide withsource
- The stats of the weapon that shot the projectile.texturePath
- The texture of the projectiletargetEntity
- the entity to follow/targetspeed
- The speed of the projectile- Returns:
- An entity for the projectile
-
createBomb
public static Entity createBomb(ProjectileTarget target, WeaponsStatsComponent source, String texturePath) -
createPistolBullet
Creates a pistol bullet entity- Returns:
- pistol bullet entity
-
createEnemyLaserProjectile
public static Entity createEnemyLaserProjectile(com.badlogic.gdx.math.Vector2 direction, WeaponsStatsComponent source) Creates a standard laser shot entity projectile- Parameters:
direction
- direction in which the projectile is shotsource
- weapon stats to derive from- Returns:
- The laser entity
-