MidPos¶
A component meant to be programmatically added to an existing EntityControl's sprite or via Unity to a model entity prefab.
This component implements the ability for multiple Transform to be linked in such a way that it simulates a chain where each nodes is in a list of Transform and they move together. The logic is very complex so for the sake of brevity, only the public fields will be documented. The component has a Start and a LateUpdate (where most of the logic happens).
Here are the public fields and their effects:
links: The list of Transform to link together. Ifgetfromchildis true, this will be set to all the child Transform on Startstart: The position of the start of the chain. Ifgetstartandendfromlinkis true, this will be overriden tolinks[0]position. Iflocalposis true, this refers to the local position insteadend: The position of the end of the chain. Ifgetstartandendfromlinkis true, this will be overriden to the lastlinkselement's position. Iflocalposis true, this refers to the local position insteadmiddle: If the magnitude of this is above 0.1, the chain will form a BeizierCurve3 from start to end with this value being the midpoint of the curve. Otherwise, the chain will move form a straight line using a lerplocalpos: If true,startandendrefers to the local position of the chain instead of the positiongetstartandendfromlinkIf true,startandendare overriden tolinks[0]position and the lastlinkselement position respectively (this is incompatible withlocalposbeing true)getfromchild: If true,linkswill be set to all child Transform on StartismodelIf true andparenttransformisn't null, the related EntityControl (used to determined if theirspritehasflip) is assumed to be in the grand grand parent ofparenttransform. Otherwise, it's assumed to be int theparenttransformdirectlyparenttransform: If this isn't null, the Transform where an EntityControl resides related to the chain (ifismodelis also true, it's assumed to be on its grand grand parent instead)