public void Activate(Sequence sequence = null) { gameObject.SetActive(true); Tween menuButtonTween = menuButtonAnimation?.Show(); if (sequence != null) { sequence.Append(menuButtonTween); } }
void CheckMenuActivation(Touch touch) { float horTouchDelta = touch.position.x - dragStartPosition.x; float lastHorDelta = touch.deltaPosition.x; beganValidDrag = false; dragStartPosition = touch.position; bool shouldShowMenu = (!isMenuActive && horTouchDelta > menuActivationDelta && lastHorDelta > 0); bool shouldHideMenu = (isMenuActive && horTouchDelta < menuDeactivationDelta && lastHorDelta < 0); if (shouldShowMenu || shouldHideMenu) { if (shouldShowMenu) { ShowMenu(); } else { HideMenu(); } } else { if (!isMenuActive) { bgBlockerInterp = 0f; slidingMenuAnimation.Hide(); Tween blockerHideTween = backgroundBlockerAnimation.Hide(); blockerHideTween.OnComplete(backgroundBlockerAnimation.Deactivate); } else { bgBlockerInterp = 1f; backgroundBlockerAnimation.Show(); Tween slideTween = slidingMenuAnimation.Show(); slideTween.OnComplete(() => SetMenuButtonsInteraction(enableInteraction: true)); } } }