Class ObstacleEventHandler
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.obstacle.ObstacleEventHandler
public class ObstacleEventHandler extends Component
Used to handle events of obstacles and enemies
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ObstacleEventHandler.ObstacleType
The types of obstacles and enemies are used to determine the type of entity that triggers the event. -
Field Summary
Fields Modifier and Type Field Description static boolean
locked
static boolean
locked_ufo
static boolean
locked2
static boolean
locked3
-
Constructor Summary
Constructors Constructor Description ObstacleEventHandler(ObstacleEventHandler.ObstacleType obstacleType)
Construct an ObstacleEventHandler and register the corresponding event according to the obstacleType. -
Method Summary
Modifier and Type Method Description void
create()
Called when the entity is created and registered.static boolean
isLocked()
getter method for lockedstatic boolean
isLocked_ufo()
getter method for locked_ufostatic boolean
isLocked2()
getter method for locked2static boolean
isLocked3()
getter method for locked3static boolean
isSpaceshipAttack()
getter method for spaceshipAttackstatic void
setSpaceshipAttack(boolean spaceshipAttack)
Setter for spaceshipAttack, used for test.Methods inherited from class com.deco2800.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Field Details
-
locked
public static boolean locked -
locked2
public static boolean locked2 -
locked3
public static boolean locked3 -
locked_ufo
public static boolean locked_ufo
-
-
Constructor Details
-
ObstacleEventHandler
Construct an ObstacleEventHandler and register the corresponding event according to the obstacleType.- Parameters:
obstacleType
- The types of obstacles.
-
-
Method Details
-
create
public void create()Description copied from class:Component
Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished. -
setSpaceshipAttack
public static void setSpaceshipAttack(boolean spaceshipAttack)Setter for spaceshipAttack, used for test.- Parameters:
spaceshipAttack
- : space ship attack or not
-
isLocked
public static boolean isLocked()getter method for locked- Returns:
- if the plant is locked
-
isLocked2
public static boolean isLocked2()getter method for locked2- Returns:
- if the thorns is locked
-
isLocked3
public static boolean isLocked3()getter method for locked3- Returns:
- if the meteorite is locked
-
isLocked_ufo
public static boolean isLocked_ufo()getter method for locked_ufo- Returns:
- if the spaceship is locked
-
isSpaceshipAttack
public static boolean isSpaceshipAttack()getter method for spaceshipAttack- Returns:
- if the spaceshipAttack is attack
-