private void FillAbsolute(float customSpacing = 0f) { foreach (MComponent child in Children) { child.ReadjustSize(); } if (DoReadjust) { ReadjustSize(); } Vector3 pos = GetAlignmentPosition(); if (customSpacing == 0f) { float offsetX = 0f + Offset.Horizontal; for (int i = 0; i < Children.Count; i++) { MComponent child = Children[i]; offsetX += child.Offset.Horizontal + child.WorldWidth / 2; child.gameobject.transform.position = new Vector3(pos.x + offsetX, pos.y + child.Offset.Vertical, pos.z); offsetX += child.WorldWidth / 2 + Spacing; } } else { float offsetX = 0f + Offset.Horizontal; for (int i = 0; i < Children.Count; i++) { MComponent child = Children[i]; child.gameobject.transform.position = new Vector3(pos.x + offsetX, pos.y + child.Offset.Vertical, pos.z); offsetX += customSpacing; } } }
/** * <summary> Constructor of ScaleFactor. </summary> * * <param name="scaleableObject"> The object to scale. </param> * <param name="horizontal"> (Optional) The horizontal scale. </param> * <param name="vertical"> (Optional) The vertical scale. </param> * * <seealso cref="MComponent"/> **/ public ScaleFactor(MComponent scaleableObject, float horizontal = 1f, float vertical = 1f) { ScaleableOject = scaleableObject; Horizontal = horizontal; Vertical = vertical; }