public GUICircularMenuOptions(GUICircularMenu owner, GUICircularData data) { isRadioGroup = new Modifiable<bool>(data.isRadioGroup,ValueChanged); openFromCenter = new Modifiable<bool>(data.openFromCenter,ValueChanged); radius = new Modifiable<float>(data.radius,ValueChanged); startAngle = new Modifiable<float>(data.startAngle,ValueChanged); arcDegrees = new Modifiable<float>(data.arcDegrees,ValueChanged); direction = new Modifiable<GUIObject.Direction>(data.direction,ValueChanged); buttonSize = new Modifiable<float>(data.buttonSize,ValueChanged); this.owner = owner; }
public static void SetPositions(GUICircularMenu menu, float t) { t = Mathf.Clamp01(t); float angle, angleSpread, baseAngle; angleSpread = ( menu.options.arcDegrees.Get() / (menu.buttons.Count-1) ) * -menu.m_directionMod; baseAngle = -menu.options.startAngle.Get(); for (int i = 0; i < menu.buttons.Count; i++) { angle = Mathf.LerpAngle( baseAngle, baseAngle + (menu.m_directionMod * ((!menu.options.openFromCenter.Get()) ? 0 : (menu.options.arcDegrees.Get()/2))) + (i*angleSpread), t ); angle *= Mathf.Deg2Rad; menu.buttons[i].position.Value = menu.position.Get() + new Vector2(menu.options.radius.Get() * Mathf.Cos(angle), menu.options.radius.Get() * Mathf.Sin(angle)); } menu.m_prevT = t; }
public static void SetButtonSize(GUICircularMenu menu, float buttonSize) { foreach(GUISquareButton button in menu.buttons) { button.size = buttonSize; } }
public static void InverseSetPostions(GUICircularMenu menu, float t) { t = 1 - Mathf.Clamp01(t); SetPositions(menu,t); }