Skip to main content

BoundsDockPositioning

A class in Root.Township, Alta.Inventory.

Overrides a dock's item placement: turns each docked pickup so its longest side lines up with the X axis and shrinks it to fit limits.

Constructors​

MemberWhat it is
BoundsDockPositioning()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private PickupDock dockThe dock this overrides. Found automatically.
private Bounds limitsBox the item must fit in. Its size should be X larger than Y larger than Z.
private float xyRatioWeightHow much longer Y must be than X (times this) before the item is stood upright.

Methods​

5 private and internal methods
MemberWhat it is
private void Awake()Sets itself as the dock's OverridePositioning.
private Quaternion GetRotation(BoundsDockPositioning.SizeOrder sizeOrder)Maps a size order (which axis is longest) to the rotation that lines it up.
private void OnDrawGizmos()Draws the limits box in the editor.
private bool Position(PickupDock dock, Item item, Pickup pickup, bool isScaling, out Vector3 position, out Quaternion rotation, out Vector3 scale)Works out rotation, scale (never above 1) and position for a pickup from its bounds. Returns false with no pickup.
private void Test()Editor context menu: lays out every child pickup as if docked.