Creating custom tools
As mentioned in Included tools and examples overview, some tools are included by default. However, your game or application may have different needs, requirements or ways to interact with the terrain. In order to support any possible interaction for the specific needs of your application, it is possible to create custom tools that allow you to create different kind of interactions.
Implementing a custom tool
In order to implement a custom tool, one needs to implement the ToolBase or SelectionToolBase classes. The ToolBase class keeps a reference to the Tycoon Tile Raycaster, subscribes to its events and allows you to interact with it. The SelectionToolBase class will keep track of terrain selection in addition to the functionality of ToolBase. If you need a tool that will function based on a terrain selection with defined size, it is recommended to use SelectionToolBase.
SelectionToolBase
SelectionToolBase is the base class to use if you want to implement a custom tool that uses terrain selection. Override the OnSelectionChanged method if you only want to perform an action when the actual selection changed. Alternatively, you can create your own Update method or similar and use the Selection property to have access to the current terrain selection. Note that you should check Selection.HasSelection to make sure that there is a valid selection.
ToolBase
If you need more control than just a terrain selection to determine the action of your tool, implementing ToolBase may be a more appropriate choice. When implementing ToolBase, you can easily interact with the TycoonTileRaycaster instance and subscribe to its events yourself. ToolBase also contains some helper properties to determine if you are currently hovering over any UGUI elements and whether you are hovering over any part of the terrain.