Skip to content

Player Highlight Selection

86LAK edited this page Sep 24, 2023 · 5 revisions

The PlayerHighlightComponent is a component responsible for rendering a highlight on the current player cursor position. This highlight appears as a box that follows the player's cursor within certain bounds (maximum reach of the player). The component also has the ability to be muted or unmuted based on specific events (while in the Tractor). This is a useful feature as players can visually see the targeted tile when using items or tools.

The PlayerHighlightComponent is used in a game environment to visually highlight the player's cursor position. It utilizes a DynamicTextureRenderComponent to display the highlight, and it can be muted to turn off the highlight effect based on game events. It is called in the PlayerHighlightFactory which returns an entity with this component.

High-Level Overview of How it works

Updates the position of the player highlight to match the current player cursor position. Translates the mouse position to world coordinates. "Locks" the highlight to the closest tile on the game map. Indicates the tile the player is currently going to act on.

UML Diagram for PlayerHighlightComponent

PlayerHighlightComponent

UML Diagram for PlayerHighlightFactory

PlayerHighlightFactory

Clone this wiki locally