Class CollectableFactory
java.lang.Object
com.csse3200.game.entities.factories.CollectableFactory
Factory for creating collectable entities (e.g., keys, coins, potions).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Entity
createCollectable
(String itemId) Creates a new collectable entity instance based on its configuration ID.static Entity
Builds a collectable upgrade that enable the dash abilitystatic Entity
Build a new collectable glider upgrade that enables the glide abilitystatic Entity
Builds a new collectable grappler upgrade that enables the grapple abilitystatic Entity
Builds a collectable key fortarget
.
-
Constructor Details
-
CollectableFactory
public CollectableFactory()
-
-
Method Details
-
createCollectable
Creates a new collectable entity instance based on its configuration ID.The returned entity includes:
- A static
PhysicsComponent
andColliderComponent
configured as a sensor obstacle. - A
CollectableComponentV2
to handle collisions and inventory logic. - Visual representation from either an animated
AnimationRenderComponent
if a sprite atlas is provided, or aTextureRenderComponent
for static images. - A
ConeLightComponent
for a visual backlight effect.
- Parameters:
itemId
- the identifier of the collectable, as defined initems.json
- Returns:
- a collectable
Entity
- Throws:
IllegalArgumentException
- ifitemId
is not registered
- A static
-
createKey
Builds a collectable key fortarget
.- Returns:
- a new key entity
- See Also:
-
createDashUpgrade
Builds a collectable upgrade that enable the dash ability- Returns:
- a new upgrade entity
- See Also:
-
createGlideUpgrade
Build a new collectable glider upgrade that enables the glide ability- Returns:
- a new upgrade entity
- See Also:
-
createGrappleUpgrade
Builds a new collectable grappler upgrade that enables the grapple ability- Returns:
- a new upgrade entity
- See Also:
-