Selection
Flexable, searchable multi-select system
Like what your seeing?
Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!
Introduction
Make game objects selectable and searchable with an easy to use and simple interface.
What can it do?
Make any game object selectable
Handle multi-select e.g. having more than 1 item selected at a time
Handles selectable types using a simple but robust tag system
Search through all selected objects
Search through all available selectables rather they are selected or not
Events
Selection Changed
Occurs when the selection state changes and expresses the set of added and removed selectables.
Each selectable has its own selection changed event which is raised when that item is added to or removed from the selection.
Concepts
Selectables
A selectable is any game object which includes a Selectable Object component. These objects will register and deregister them selves from the selection system on create and destroy respectivly and can be used to search selections, available selectablles and to get specific selected objects.
A core concept at use by the selection system is the Heathen Tag system. This allows you to mark up selectables with specific tags. You can use these tags with the selection system to get the set of all selected objects which have a given tag or tags.
Example
Imagin we have the following tags
UnitTag
InfantryTag
CalvaryTag
AirTag
SeaTag
In this case all of our units would be selectables and would have at least 2 tags being Unit and whatever type of Unit they where such as Infantry. The player can now select a group of units regardless of what type they may be and we can get the subset of the selected units that match a given type e.g.