Class ButtonFactory
java.lang.Object
com.csse3200.game.entities.factories.ButtonFactory
Factory class for creating button entities.
Image texture depends on type (blue for platform, red for door and white for standard)
Static body means that it is immovable and attaches ButtonComponent, as well as collider so that
other objects can collide and not move it.
PhysicsLayer is OBSTACLE so that the light cannot go through it and the player can hide behind it
-
Method Summary
Modifier and TypeMethodDescriptionstatic Entity
createButton
(boolean isPressed, String type, String direction) Creates a button entity with specified state and type Uses getTextureRenderComponent to assign texture colour and state depending on type and pressedstatic Entity
createPuzzleButton
(boolean isPressed, String type, String direction, ButtonManagerComponent manager) Creates button entity that is part of button puzzle Button is linked to a ButtonManagerComponent, which tracks all buttons assigned to the puzzle
-
Method Details
-
createButton
Creates a button entity with specified state and type Uses getTextureRenderComponent to assign texture colour and state depending on type and pressed- Parameters:
isPressed
- whether button should start in pressed state or nottype
- type of button (door, platform, standard)- Returns:
- fully configured button entity
-
createPuzzleButton
public static Entity createPuzzleButton(boolean isPressed, String type, String direction, ButtonManagerComponent manager) Creates button entity that is part of button puzzle Button is linked to a ButtonManagerComponent, which tracks all buttons assigned to the puzzle- Parameters:
isPressed
- whether button should start in pressed state or nottype
- type of button (door, platform, standard) (standard if not recognised)direction
- the direction the button should face (left, right, up, down) (left if not recognised)manager
- ButtonManagerComponent managing this button's puzzle- Returns:
- fully configured puzzle entity button
-