public void NextText() { if (ActivePage + 1 >= PopupTexts.Count) { DoExitAnimation(); return; } //Play animation animator.Play("Next", 0, 0.0f); //animator.SetBool("Next", true); textBackTween.Complete(); textFrontTween.Complete(); TextBack.alpha = 1f; TextFront.alpha = 0f; TextBack.text = TextFront.text; TextFront.text = PopupTexts[++ActivePage]; textBackTween = DOTween.To(x => TextBack.alpha = x, 1f, 0f, FadeDurationOut).SetEase(FadeEaseOut); textFrontTween = DOTween.To(x => TextFront.alpha = x, 0f, 1f, FadeDurationIn).SetEase(FadeEaseIn); OnPageTurnTick(); }
private void AvatarCreation_NextStep() { selectionStep++; if (stepTween != null) { stepTween.Complete(); } Categories[selectionStep].gameObject.SetActive(true); stepTween = CategoriesContainer.DOAnchorPosY(StartupOffsetY - selectionStepOffsetY * selectionStep, 0.4f); playAudioDescription(State, selectionStep); }
public void CorrectMoustache() { StaticVariables.money += 20; StaticVariables.dayGanances[actualIndex] = 20; goodText.gameObject.SetActive(true); if (tween != null) { tween.Complete(); } goodText.GetComponent <RectTransform> ().anchoredPosition = Vector2.zero; tween = goodText.GetComponent <RectTransform> ().DOAnchorPosY(1000, 10); }
private void Update() { if (activeTween != null && Input.GetKeyDown(KeyCode.Space)) { activeTween.Complete(); } }
private static int Complete(IntPtr L) { int result; try { int num = LuaDLL.lua_gettop(L); if (num == 1 && TypeChecker.CheckTypes(L, 1, typeof(Tween))) { Tween t = (Tween)ToLua.ToObject(L, 1); t.Complete(); result = 0; } else if (num == 2 && TypeChecker.CheckTypes(L, 1, typeof(Tween), typeof(bool))) { Tween t2 = (Tween)ToLua.ToObject(L, 1); bool withCallbacks = LuaDLL.lua_toboolean(L, 2); t2.Complete(withCallbacks); result = 0; } else { result = LuaDLL.luaL_throw(L, "invalid arguments to method: DG.Tweening.Tween.Complete"); } } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
public void ShowFullText() { if (Tween != null) { Tween.Complete(); } }
private void UpdatePistonState() { currentStep++; if (buttonTween != null && buttonTween.IsPlaying()) { buttonTween.Complete(); } buttonTween = buttonRectTransform.transform.DOPunchScale(Vector3.one * 0.3f, 0.3f, 20); if (currentStep > steps) { Crush(); textJitterMovement.SetActiveJitter(false); } else { if (currentStep >= steps) { counterText.text = "GO"; textJitterMovement.SetActiveJitter(true); buttonImage.color = readyToCrushButtonColor; } else { counterText.text = (steps - currentStep).ToString(); } StartCoroutine(StepMovementCoroutine()); } }
/// <summary> /// Flip the card and show the front or the rear either /// </summary> public void Flip() { FrontFaced = !FrontFaced; if (tweenFlip != null && tweenFlip.IsPlaying()) { tweenFlip.Complete(); } //Tween that manage rotation and sprite change tweenFlip = transform.DORotate(new Vector3(0, 90, 0), flipTime / 2).OnComplete(() => { if (!FrontFaced) { SpriteRndBase.sprite = back; SpriteRndCenter.enabled = false; SpriteRndTopRight.enabled = false; SpriteRndTopLeft.enabled = false; } else { SpriteRndBase.sprite = front; SpriteRndCenter.enabled = true; SpriteRndTopRight.enabled = true; SpriteRndTopLeft.enabled = true; } transform.DORotate(Vector3.zero, flipTime / 2); }); }
void back(int actionNumber) { MusicManager.instance.PlayMusic(); tween.SetLoops(0); tween.Complete(); ((Transform)tween.target).rotation = Quaternion.identity; tween.Kill(); Sequence mySequence = DOTween.Sequence(); mySequence.Join(buttons[0].transform.DOScale(Vector3.zero, 0.3f).SetEase(Ease.InOutBack).SetUpdate(true)); mySequence.Join(buttons[1].transform.DOScale(Vector3.zero, 0.3f).SetEase(Ease.InOutBack).SetUpdate(true)); mySequence.Append(popup.transform.DOLocalMoveY(-1000, 0.5f).SetEase(Ease.InOutBack).SetUpdate(true)); mySequence.OnComplete(() => { Time.timeScale = 1; switch (actionNumber) { case 1: LoadingManager.scenename = "Main"; SceneManager.LoadScene("Loading"); break; case 2: gameObject.SetActive(false); //PlayUIManager.instance.EnableGameObjects(); break; } }); mySequence.SetUpdate(true); }
private void TryInit() { if (previous != null && !previous.IsComplete()) previous.Complete(); if (!isCashed) Init(); isCashed = true; }
void EnterSetting() { if (!_canEnterSetting) { _canEnterSetting = true; _imageSetting.transform.localScale = Vector3.zero; _imageSetting.DOColor(Color.white, 1); _imageSetting.transform.DOScale(1, 1); m_ReturnTween = DOTween.Sequence().AppendInterval(3).AppendCallback(() => { _imageSetting.transform.DOScale(0, 1).OnComplete(() => _imageSetting.transform.localScale = Vector3.one); _imageSetting.DOColor(Color.clear, 1); _canEnterSetting = false; }); return; } RemoveGameplayListener(); _canEnterSetting = false; m_ReturnTween.Complete(false); _imageSetting.DOColor(Color.clear, 1) /*.OnComplete(() => GameMgr.instance.SetGameState(eGameState.eInSetting))*/; //_imageSetting.transform.DOScale(0, 1).OnComplete(() => _imageSetting.enabled = false); GameMgr.Instance.GetGameStateMgr().SetGameState(GameState.InSetting); }
public void Show(bool _doShow, bool _immediate = false) { IsShown = _doShow; if (_doShow) { this.gameObject.SetActive(true); AudioManager.I.PlaySfx(Sfx.WalkieTalkie); StopPulse(true); if (_immediate) { showTween.Complete(); } else { showTween.PlayForward(); } } else { StopPulse(true); if (_immediate) { showTween.Rewind(); } else { showTween.PlayBackwards(); } } }
public void CloseAd(Action onAdHidden = null) { Time.timeScale = 1; if (!CloseButton) { return; } if (_onRewarded != null || _onSkipped != null) { if (_remainingTimer <= 0) { _onRewarded.SafeInvoke(Random.Range(1, 5)); } else { _onSkipped.SafeInvoke(); } } if (_tween != null && _tween.IsActive()) { _tween.Complete(); _tween.Kill(); } CloseButton.interactable = false; onAdHidden.SafeInvoke(); OnAdClosed.SafeInvoke(); this.Deactivate(); }
private void Click(RaycastHit hit) { var goId = hit.collider.transform.parent.gameObject.GetInstanceID(); var newIndex = Array.IndexOf(_goIds, goId); // If already on the clicked selector ( or close enough ) if (newIndex == currentIndex || (newIndex == currentIndex - _indexDiff && Mathf.Abs(_indexDiff - _animProgression) < 0.25f)) { levels[newIndex].LevelButton.Click(); return; } // Complete animation if not already if (_tween != null && !_tween.IsComplete()) { _tween.Complete(); } _indexDiff = currentIndex - newIndex; _tween = DOTween.To(value => _animProgression = value, 0f, _indexDiff, transitionDuration); _tween.onUpdate = CalcPos; _tween.onComplete = () => { currentIndex = newIndex; _animProgression = 0f; _indexDiff = 0; CalcPos(); }; }
public virtual void ForceEnd() { if (currentCameraTween != null) { currentCameraTween.Complete(); } }
private void Start() { Tween tween = null; this.face.Value = Vector2.right; this.face .Select(dir => Vector3.SignedAngle(Vector2.right, dir, Vector3.forward)) .Subscribe(deg => { tween?.Complete(); tween = transform .DORotate( Quaternion.Euler(0, 0, deg).eulerAngles, Mathf.Lerp(0.3f, 0.7f, (deg - Quaternion.Euler(transform.right).z) / 180) ) .SetEase(Ease.OutQuad); }) .AddTo(this); var sr = GetComponent <SpriteRenderer>(); // TODO: mayber a better way to extend color method... var originalColor = Color.black.Copy(sr.color); this.status.hasBomb .Subscribe(bomb => { sr.DOColor( bomb ? Color.red : originalColor, 0.5f ); }) .AddTo(this); }
public IEnumerator Shake(GameObject go) { // 1. Get ready to shake, by setting the node.transform.properties to their original state go.transform.localScale = new Vector3(1, 1, 1); go.transform.localRotation = originalRot; // 2. Complete any tweens that are already in progress if (scaleTween != null && rotTween != null) { scaleTween.Complete(); rotTween.Complete(); } // 3. Shake! scaleTween = go.transform.DOPunchScale(new Vector3(SHAKE_PUNCH_AMT, SHAKE_PUNCH_AMT, SHAKE_PUNCH_AMT), 2.0f, 7); rotTween = go.transform.DOPunchRotation(new Vector3(0, 10.0f, 0), 2.0f, 5); shaken = true; // 4. Emit the node's gatherable items yield return(StartCoroutine(EmitNodeObject(Random.Range((int)3, (int)8)))); // 5. All done! shaken = false; yield return(this); }
void OnDestroy() { if (_tween != null) { _tween.Complete(); _tween = null; } }
void OnMouseUp() { tween.Complete(); lastPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); //Debug.LogFormat("onMouseUp != null"); onMouseUp?.Invoke(firstPosition, lastPosition); }
private void HidePanel() { if (this.gameObject != EventManager.GetRegisteredSender()) return; Debug.Log("Hiding " + name); m_CanInteract = false; m_Transparency.DOFade(0, 0.15f); if (m_IsInteractable) { interactableImageTween.SetLoops(0); interactableImageTween.Complete(); interactableImageTween.Kill(); m_InteractableImage.rectTransform.localScale = m_InteractableImageScale; } }
void CloseTweener() { if (m_CameraTween != null) { m_CameraTween.Complete(); m_CameraTween.Kill(); m_CameraTween = null; } }
IEnumerator Start() { yield return(new WaitForSeconds(0.6f)); Tween t = trans.DOShakePosition(2, 1, 14).SetAutoKill(false); t.Complete(); t.PlayBackwards(); }
public void OnTriggerExit(Collider other) { text.gameObject.SetActive(false); interactableImageTween.SetLoops(0); interactableImageTween.Complete(); interactableImageTween.Kill(); m_InteractableImage.DOFade(0, 0.25f); m_InteractableImage.rectTransform.localScale = m_InteractableImageScale; }
/// <summary> /// Place the card at _targetPos /// </summary> /// <param name="_targetPos"></param> public void Move(Vector3 _targetPos) { if (tweenMove != null && tweenMove.IsPlaying()) { tweenMove.Complete(); } tweenMove = transform.DOMove(_targetPos, moveTime); }
void Awake() { // Tweens loseTween = Star.DOScale(0.001f, 0.25f).SetAutoKill(false).Pause() .OnComplete(() => Star.gameObject.SetActive(false)); loseTween.ForceInit(); gainTween = Star.DOScale(0.001f, 0.5f).From().SetEase(Ease.OutElastic, 1.70f, 0.5f).SetAutoKill(false).Pause(); loseTween.Complete(); }
public override void Stop() { if (!_audioSource) { return; } _audioSource.Stop(); _volumeTween?.Complete(); _audioSource.volume = tileMovementAudioVolume; }
public override void OnEnd() { base.OnEnd(); if (!tween.IsComplete()) { tween.Complete(); tween.Kill(); tween = null; } }
public void PlayNotEnoughEnergyAnimation() { neeTweenShake.Complete(); neeTweenShake = transform.DOShakePosition(0.2f, 0.1f, 20); neeTweenLerp.Complete(); colorLerpAmount = 1f; neeTweenLerp = DOTween.To(() => colorLerpAmount, (x) => colorLerpAmount = x, 0, 0.25f) .OnUpdate(() => fillImage.color = Color.Lerp((lastRatio >= 1) ? fillColor : Color.white, Color.red, colorLerpAmount)); }
private static void Play(AudioClip clip) { if (tween != null) { tween.Complete(); } singleton.source.volume = 1; singleton.source.PlayOneShot(clip); }
public void Play() { if (currentTween != null) { currentTween.Complete(); } else { currentTween = MainCameraBuffer.Get().transform.DOShakePosition(duration, strength, vibrato, randomness, snapping, fadeOut).OnComplete(OnComplete); } }