Last updated: May 30, 2023 21:40:52
Entity Linker
Table of contents
TimberAPI adds a custom EntityLinker
Monobehaviour class to all buildings in the game. The EntityLinker
class can be used to link two entities with eachother. A new link creates a new instance of EntityLink
which is stored in both the linker and linkees EntityLinks
property.
Creating a new link
var linker = gameObject.GetComponent<EntityLinker>();
var linkee = otherGameObject.GetComponent<EntityLinker>();
linker.CreateLink(linkee);
Deleting a link
var linker = gameObject.GetComponent<EntityLinker>();
linker.DeleteLink(linker.EntityLinks.First());
Usage
The use of these links is left to the modder. See the EntityLinkerExample on the TimberAPI Examples for an example implementation.