public static void ShowPopup(GameObject popup, Action callback = null) { // Reset button scale popup.ResetButtonScale(true); // Show popup popup.Show(); // Fade-in popup.Play(FadeAction.FadeTo(popupEndOpacity, popupDuration)); // Content GameObject content = popup.FindInChildren("Popup"); if (content != null) { content.transform.localScale = popupStartScale; var zoomOut = ScaleAction.ScaleTo(popupEndScale, popupDuration * 0.7f); var zoomIn = ScaleAction.ScaleTo(Vector3.one, popupDuration * 0.3f); var action = SequenceAction.Create(zoomOut, zoomIn); content.Play(action, callback); } else { if (callback != null) { callback(); } } }
void Start() { // Set scale transform.localScale = scale; gameObject.Play(ParallelAction.ParallelAll(ScaleAction.ScaleTo(scale * Random.Range(minScale, maxScale), scaleDuration), FadeAction.FadeOut(fadeDuration)), () => { GameObject.Destroy(gameObject); }); }
public void OnHint() { gameObject.StopAction("hint", true); var zoom = ScaleAction.ScaleTo(hintScale, 0.1f, Ease.Linear, LerpDirection.PingPong); var action = RepeatAction.Create(zoom, 3, false); gameObject.Play(action).name = "hint"; }
public static BaseAction GetJellyAction() { var scale1 = ScaleAction.ScaleTo(new Vector3(1.1f, 0.9f, 1), 0.1f); var scale2 = ScaleAction.ScaleTo(new Vector3(0.9f, 1.1f, 1), 0.1f); var scale3 = ScaleAction.ScaleTo(new Vector3(1f, 1f, 1), 0.1f); var sequence = SequenceAction.Create(scale1, scale2, scale3); return(sequence); }
void UpdateTime() { // Get current time int time = Mathf.CeilToInt(_time); if (time != _currentTime) { if (_currentTime > 0) { // Frame frame.StopAction(); frame.Show(); frame.Play(BlinkAction.Create(2, 0.3f, false, false), () => { frame.Hide(); }); // Play effect GameObject effect = numberEffect.gameObject; effect.StopAction(true); effect.Show(); effect.transform.localScale = Vector3.one; effect.SetColor(_currentTime > 3 ? Color.white : alarmColor, true); numberEffect.Number = _currentTime; var zoomOut = ScaleAction.ScaleTo(alarmScale, alarmDuration); var fadeOut = FadeAction.RecursiveFadeOut(alarmDuration); var hide = HideAction.Create(); effect.Play(SequenceAction.Create(ParallelAction.ParallelAll(zoomOut, fadeOut), hide)); } // Set current time _currentTime = time; // Update number number.Number = time; } }