Class ConnectedEntityUtility
java.lang.Object
com.csse3200.game.components.placeables.ConnectedEntityUtility
Used by placeable components to handle connected textures and other functionality that requires a Placeable to
interact dynamically with other Placeable entities.
This component should be a composite component of the target entity.
For example an entity adds a SprinklerComponent OR a FenceComponent which creates a new instance of this component,
and passes the entity to its constructor.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte
Gives a 4-bit representation of the adjacent Placeable entities.protected Entity[]
Getter for this adjacent entity array.void
Used by a Placeable entity after some update has occurred.
-
Constructor Details
-
ConnectedEntityUtility
-
-
Method Details
-
getAdjacentEntities
Getter for this adjacent entity array.- Returns:
- this array of adjacent entities.
-
notifyAdjacent
public void notifyAdjacent()Used by a Placeable entity after some update has occurred. Notifies the calling's adjacent entities via a trigger. -
getAdjacentBitmap
public byte getAdjacentBitmap()Gives a 4-bit representation of the adjacent Placeable entities. This is very useful for texture selection since the 4-bit number acts as an index into an ordered texture array. See usages in SprinklerComponent.java.- Returns:
- 4-bit number representation of the target entities adjacent Placeable entities.
-