SpaceRTS - Starter Pack  1.3
GameBase.SelectionInput Class Reference

Acts as a nexus between the input (clicks, selection box, etc) and the SelectionSystem. More...

Inheritance diagram for GameBase.SelectionInput:

Public Member Functions

void StartSelectionBox ()
 Start a new selection box mode, also remove all the currently selected and hovered GameEntities from the SelectionSystem. More...
 
void SetupSelectionBox (Vector2 min, Vector2 max)
 Setups the current selection box mode with the two screen coords defining the bounds of that selection. More...
 
void EndSelectionBox ()
 Ends the selection box mode and confirms all highlighted GameEntities as Selected. More...
 
void CancelSelectionBox ()
 Cancels the current selection box mode and removes all current hovering flags from the SelectionSystem. More...
 
void ProcessClickEvent (BaseEventData eventData)
 Handle the click event and filters the left click to select a GameEntity. After that the event is derived to the ProcessLeftClickEvent() method. More...
 
void ProcessLeftClickEvent ()
 Direct selection of the GameEntity through Left click. This method handles the additive selection when ctrl key is pressed. Also unselects current selected eGameEntities when no ctrl key is selected. More...
 

Static Public Member Functions

static Bounds GetViewportBounds (Vector3 screenPosition1, Vector3 screenPosition2)
 Converts two screen positions into a bounds rectangle in viewport coordinates. More...
 

Public Attributes

ISelectableCriteria selectionCriteria
 The currently selection criteria to filter from all the hovered entities which one would be selected. If no one is defined, by default all the hovered entities will be highlighted for selection. More...
 
bool selectionBoxAllowed = true
 Indicates if it's allowed to select units through a selection box. More...
 
bool multipleSelectionAllowed = true
 Indicates if it's allowed to select multiple units of just one at the time. More...
 
LayerMask raycastMask = -1
 The mask to be used by the raycast to filter which colliders are valid to hover, highlight and select. More...
 
bool useCustomClickInput = false
 Indicates if the system must use a simple implementation of the input reading (using the standard Input class). Or there is a custom implementation that will handle the correct calls to ProcessLeftClickEvent, StartSelectionBox, etc. More...
 
bool useCustomHoverInput = false
 Indicates if the system must use a simple implementation of the input reading (using the standard Input class). Or there is a custom implementation that will handle the correct calls to ProcessHoveringRay. More...
 

Protected Member Functions

virtual void Start ()
 
virtual void Update ()
 Handles the box and single click selection modes. More...
 
virtual void OnDisable ()
 When disabled actomatically cancels the selection box mode. More...
 

Detailed Description

Acts as a nexus between the input (clicks, selection box, etc) and the SelectionSystem.

Member Function Documentation

◆ CancelSelectionBox()

void GameBase.SelectionInput.CancelSelectionBox ( )

Cancels the current selection box mode and removes all current hovering flags from the SelectionSystem.

◆ EndSelectionBox()

void GameBase.SelectionInput.EndSelectionBox ( )

Ends the selection box mode and confirms all highlighted GameEntities as Selected.

◆ GetViewportBounds()

static Bounds GameBase.SelectionInput.GetViewportBounds ( Vector3  screenPosition1,
Vector3  screenPosition2 
)
static

Converts two screen positions into a bounds rectangle in viewport coordinates.

Parameters
screenPosition1first position in screen coords.
screenPosition2second position in screen coords.
Returns
Bounds rectangle in viewport coordinates.

◆ OnDisable()

virtual void GameBase.SelectionInput.OnDisable ( )
protectedvirtual

When disabled actomatically cancels the selection box mode.

◆ ProcessClickEvent()

void GameBase.SelectionInput.ProcessClickEvent ( BaseEventData  eventData)

Handle the click event and filters the left click to select a GameEntity. After that the event is derived to the ProcessLeftClickEvent() method.

Parameters
eventDataInput event data related to the click.

◆ ProcessLeftClickEvent()

void GameBase.SelectionInput.ProcessLeftClickEvent ( )

Direct selection of the GameEntity through Left click. This method handles the additive selection when ctrl key is pressed. Also unselects current selected eGameEntities when no ctrl key is selected.

◆ SetupSelectionBox()

void GameBase.SelectionInput.SetupSelectionBox ( Vector2  min,
Vector2  max 
)

Setups the current selection box mode with the two screen coords defining the bounds of that selection.

Parameters
minLeft bottom screen coordinates for the selection bounding box.
maxRight top screen coordinates for the selection bounding box.

◆ Start()

virtual void GameBase.SelectionInput.Start ( )
protectedvirtual

◆ StartSelectionBox()

void GameBase.SelectionInput.StartSelectionBox ( )

Start a new selection box mode, also remove all the currently selected and hovered GameEntities from the SelectionSystem.

◆ Update()

virtual void GameBase.SelectionInput.Update ( )
protectedvirtual

Handles the box and single click selection modes.

Member Data Documentation

◆ multipleSelectionAllowed

bool GameBase.SelectionInput.multipleSelectionAllowed = true

Indicates if it's allowed to select multiple units of just one at the time.

◆ raycastMask

LayerMask GameBase.SelectionInput.raycastMask = -1

The mask to be used by the raycast to filter which colliders are valid to hover, highlight and select.

◆ selectionBoxAllowed

bool GameBase.SelectionInput.selectionBoxAllowed = true

Indicates if it's allowed to select units through a selection box.

◆ selectionCriteria

ISelectableCriteria GameBase.SelectionInput.selectionCriteria

The currently selection criteria to filter from all the hovered entities which one would be selected. If no one is defined, by default all the hovered entities will be highlighted for selection.

◆ useCustomClickInput

bool GameBase.SelectionInput.useCustomClickInput = false

Indicates if the system must use a simple implementation of the input reading (using the standard Input class). Or there is a custom implementation that will handle the correct calls to ProcessLeftClickEvent, StartSelectionBox, etc.

◆ useCustomHoverInput

bool GameBase.SelectionInput.useCustomHoverInput = false

Indicates if the system must use a simple implementation of the input reading (using the standard Input class). Or there is a custom implementation that will handle the correct calls to ProcessHoveringRay.