void Start() { UpdateButtonsNumber(); actualState = EtatMenu.Inactive; // Auto active if (startActive) ShowMenu(); }
/// <summary> /// Function called to set the menu state to actif. /// It is the state of the menu when he is shown and all the transitions are done. /// </summary> private void StabiliseMenu() { if (ActivatedCallBack != null) ActivatedCallBack(); actualCircleRadius = circleRadius; actualState = EtatMenu.Active; }
/// <summary> /// Function called to show the circular menu. It launch the transition if needed. /// </summary> public void ShowMenu(bool _instantly = false ) { if (radiusTransition && useTransitions && !_instantly) actualCircleRadius = 0; else actualCircleRadius = circleRadius; if (fadeTransition && useTransitions && !_instantly) actualAlpha = 0; else actualAlpha = 1; if (sizeTransition && useTransitions && !_instantly) actualBtnSize = 0; else actualBtnSize = buttonSize; if (fanTransition && useTransitions && !_instantly) actualOpenAngle = 0; else actualOpenAngle = menuMaxOpenAngle; actualRotAngle = 0; menuIsActive = true; if (useTransitions && !_instantly) { startTime = Time.fixedTime; actualState = EtatMenu.Show; } else actualState = EtatMenu.Active; }
/// <summary> /// Function called to desappear the circular menu. /// It is the state of the menu when he desappear and all the transitions are done. /// </summary> private void DesactivateMenu() { if (DesactivatedCallBack != null) DesactivatedCallBack(); actualState = EtatMenu.Inactive; actualCircleRadius = 0; actualAlpha = 0; actualRotAngle = 0; menuIsActive = false; }
/// <summary> /// Function called to hide the circular menu. It launch the transition if needed. /// </summary> public void HideMenu(bool _instantly = false) { if (actualState == EtatMenu.Active || actualState == EtatMenu.Show) { if (useTransitions && !_instantly) { lockedAlpha = actualAlpha; lockedBtnSize = actualBtnSize; lockedRotAngle = actualRotAngle; lockedRadius = actualCircleRadius; lockedOpenAngle = actualOpenAngle; startTime = Time.fixedTime; actualState = EtatMenu.Hide; } else { actualState = EtatMenu.Inactive; DesactivateMenu(); } } }