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.
- Listed in Items, inventory and logic
- Inherits or implements
MonoBehaviour - Nested types
SizeOrder
Constructors
| Member | What it is |
|---|---|
BoundsDockPositioning() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|---|
private PickupDock dock | The dock this overrides. Found automatically. |
private Bounds limits | Box the item must fit in. Its size should be X larger than Y larger than Z. |
private float xyRatioWeight | How much longer Y must be than X (times this) before the item is stood upright. |
Methods
5 private and internal methods
| Member | What 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. |