public void OnCoverUnloaded() { mask.DOKill(); mask.DOFade(1, 0.4f).SetEase(Ease.OutCubic); transform.DOKill(); transform.DOScale(1f, 0.4f).SetEase(Ease.InOutFlash); colorTweener?.Kill(); }
void Update() { if (transition) { return; } if (Physics2D.OverlapPoint(Cam.ScreenToWorldPoint(Input.mousePosition))) { spin.Rate = Mathf.SmoothDamp(spin.Rate, 100f, ref spinVel, 0.5f); if (Input.GetMouseButtonDown(0)) { Transition(); transition = true; return; } if (!play) { play = true; rotTween?.Kill(); textTween?.Kill(); lineTween?.Kill(); rotTween = DOTween.To(() => rot, (float value) => rot = value, 180, Length) .SetEase(Ease.InOutCubic); textTween = DOTween.To(() => text.color, (Color value) => text.color = value, clearGreen, Length) .SetEase(Ease.InOutCubic); lineTween = DOTween.To(() => line.Color, (Color value) => line.Color = value, green, Length) .SetEase(Ease.InOutCubic); } } else { spin.Rate = Mathf.SmoothDamp(spin.Rate, 10f, ref spinVel, 0.5f); if (play) { play = false; rotTween?.Kill(); textTween?.Kill(); lineTween?.Kill(); rotTween = DOTween.To(() => rot, (float value) => rot = value, 0, Length) .SetEase(Ease.InOutCubic); textTween = DOTween.To(() => text.color, (Color value) => text.color = value, green, Length) .SetEase(Ease.InOutCubic); lineTween = DOTween.To(() => line.Color, (Color value) => line.Color = value, clearGreen, Length) .SetEase(Ease.InOutCubic); } } transform.rotation = Quaternion.Euler(0, 0, rot); }
public void StopTimeMeter() { _timerTween.Kill(); hpText.text = "0"; shieldText.text = "0"; levelText.text = "Danger: 0"; }
private void TryStopAnimation() { if (_animation != null && _animation.IsPlaying()) { _animation.Kill(); } }
private static void RemoveTopQuickTip(int removeCount) { RectTransform rect = QuickTipList[0].GetComponent <RectTransform>(); float deltaHeight = -rect.sizeDelta.y * removeCount; for (int idx = 0; idx < removeCount; ++idx) { Transform quickTip = QuickTipList[idx]; TweenerCore <Color, Color, ColorOptions> tween = TweenDic[quickTip]; if (tween != null) { tween.Kill(); TweenDic[quickTip] = null; } RecycleTip(quickTip); } for (int idx = removeCount; idx < QuickTipList.Count; ++idx) { QuickTipList[idx - removeCount] = QuickTipList[idx]; rect = QuickTipList[idx].GetComponent <RectTransform>(); Vector3 pos = rect.anchoredPosition; pos.y += deltaHeight; rect.anchoredPosition = pos; } QuickTipList.RemoveRange(QuickTipList.Count - removeCount, removeCount); }
private IEnumerator LoadingBarCoroutine() { _loadingBar.fillAmount = 0f; while (true) { yield return(new WaitUntil(() => _loadBarQueue.Count > 0)); var loadBarConfig = _loadBarQueue.Dequeue(); var timeSinceLastSection = Time.timeSinceLevelLoad - _timeLastTipShown; if (timeSinceLastSection < loadBarConfig.LoadDelay) { yield return(new WaitForSeconds(loadBarConfig.LoadDelay - timeSinceLastSection)); } _fillTween?.Kill(); _fillTween = _loadingBar.DOFillAmount( loadBarConfig.LoadPercent, loadBarConfig.LoadTime) .SetEase(loadBarConfig.LoadEase); yield return(_fillTween.WaitForCompletion()); } }
public void ClearCache() { if (mPathTween != null) { mPathTween.Kill(); mPathTween = null; } }
public void OnPointerExit(PointerEventData eventData) { if (isText) { _growthAnimation.Kill(); _text.DOFontSize(_originalFontSize, duration); } }
public void AnimateMaterialValue(string uniform, float animaeteTo, float time) { if (_tween != null) { _tween.Kill(); } _tween = DOTween.To(() => _material.GetFloat(uniform), value => _material.SetFloat(uniform, value), animaeteTo, time); }
private void CreateNewTween(Vector3 startPoint, Vector3 endPoint) { _p0 = startPoint; _p1 = new Vector3(_p0.x, _p0.y + 1f, _p0.z); _p3 = endPoint; _p2 = new Vector3(_p3.x, _p3.y + 1f, _p3.z); if (_currentTween != null) { _currentTween.Kill(); } _currentTween = DOTween.To(() => _currentT, value => { _currentT = value; TweenHelper(value); }, 1f, 0.5f); }
public void MoveInto(Turret current, TweenCallback callback) { floatTween.Kill(); var seq = DOTween.Sequence(); seq.Join(transform.DOMove(current.transform.position, .5f)); seq.Join(transform.DOScale(Vector3.zero, .5f)); seq.AppendCallback(callback); }
protected virtual bool TryMove(IBaseNode node) { if (node == null || AStarMgr.ExSeizeNodeData.IsHaveUnit(node) || AStarMgr.IsHaveUnit(node)) { return(false); } else { ClearCurNode(); var curNode = AStarMgr.GetNode(SelfBaseUnit.Pos); AStarMgr.ExSeizeNodeData.ClearSeizeNode(curNode, SelfBaseUnit); AStarMgr.ExSeizeNodeData.SetSeizeNode(node, SelfBaseUnit); TweenLastMove?.Kill(); TweenLastMove = DOTween.To(() => SelfBaseUnit.Pos, x => SelfBaseUnit.Pos = x, node.Pos, MoveSpeed).SetEase(Ease.Linear); return(true); } }
private void Removal() { _internalTween.Kill(); if (_logicCoroutine != null) { StopCoroutine(_logicCoroutine); } LeanPool.Despawn(this, 0.8f); _dead = true; }
public override void Hide() { if (showTweenerCore != null) { showTweenerCore.Kill(); } Dispose(); enabled = false; }
private void Update() { if (Math.Abs(_heightDriver.sizeDelta.y - _previousHeight) > 0.5f) { var target = new Vector2(_self.sizeDelta.x, _heightDriver.sizeDelta.y + _baseHeight); _tween?.Kill(); _tween = _self.DOSizeDelta(target, 0.2f); _previousHeight = _heightDriver.sizeDelta.y; } }
public override void OnPointerEnter(PointerEventData eventData) { if (IsSelected) { return; } if (!IsInteractable) { return; } if (Graphic == null) { return; } if (colorTween != null) { colorTween.Kill(); } if (Text != null) { colorTween = DOTween.To(() => Text.color, x => Text.color = x, StateColor.Enter, Duration).SetDelay(Delay); } else if (Image != null) { colorTween = DOTween.To(() => Image.color, x => Image.color = x, StateColor.Enter, Duration).SetDelay(Delay); } else { //Graphic.CrossFadeColor(Enter, Duration, true, true); } }
public override void OnPointerEnter(PointerEventData eventData) { if (IsSelected) { return; } if (!IsInteractable) { return; } if (Effect == null) { return; } if (colorTween != null) { colorTween.Kill(); } if (Shadow != null) { colorTween = DOTween.To(() => Shadow.effectColor, x => Shadow.effectColor = x, StateColor.Enter, Duration).SetDelay(Delay); } else if (Outline != null) { colorTween = DOTween.To(() => Outline.effectColor, x => Outline.effectColor = x, StateColor.Enter, Duration).SetDelay(Delay); } else { } }
/// <summary> /// Set positions depending on resolution /// </summary> private void PositionUpdateResolution() { _normWindow = Screen.width / DefaultScreenWidth; var rect = currentQuestRectTrans.rect; _defaultPos.x = DefaultScreenWidth * _normWindow + rect.width / (2 / _normWindow); _tweener.Kill(); _tweener = !_isDisplayVisible ? currentQuestRectTrans.DOMoveX(_defaultPos.x, durationMovement) : currentQuestRectTrans.DOMoveX(_defaultPos.x - rect.width * _normWindow, durationMovement); }
private void TweenScrollbar() { TweenerCore <Color, Color, ColorOptions> fadeTween = null; var isScroll = false; void FadeScrollbar(float value = 0.0f) { fadeTween?.Kill(); fadeTween = _scrollRect.verticalScrollbar.targetGraphic .DOFade(value, Const.UI_ANIMATION_TIME); } FadeScrollbar(); this.UpdateAsObservable() .Where(_ => isScroll == false) .Where(_ => _scrollRect.velocity.y >= 3.0f || _scrollRect.velocity.y <= -3.0f) .Subscribe(_ => { isScroll = true; FadeScrollbar(0.75f); }) .AddTo(this); this.UpdateAsObservable() .Where(_ => isScroll) .Where(_ => _scrollRect.velocity.y <3.0f && _scrollRect.velocity.y> -3.0f) .Subscribe(_ => { isScroll = false; FadeScrollbar(); }) .AddTo(this); this.OnDisableAsObservable() .Subscribe(_ => fadeTween?.Kill()) .AddTo(this); }
public void Show(bool b) { if (IsFogShow == b) { return; } IsFogShow = b; if (fogAlphaTween != null) { fogAlphaTween.Kill(); } //tween地图颜色 fogAlphaTween = DOTween.To(() => FOW.fogColor.a, x => FOW.fogColor.a = x, b ? 0.5f : 0.0f, 0.3f); }
public void DoThePath() { _pathTweener?.Kill(); _transform.position = _basePosition; _waypoints = new Vector3[_pathData.Waypoints.Length]; for (var i = 0; i < _waypoints.Length; i++) { _waypoints[i] = _basePosition + _pathData.Waypoints[i]; } _pathTweener = _transform.DOPath(_waypoints, _pathData.Duration, _pathData.PathType) .SetDelay(Delay) .OnComplete(Die); }
private void Start() { isMove = false; _isStop = true; this.OnCollisionEnter2DAsObservable() .Select(other => other.gameObject.GetComponent <IHittable>()) .Where(hittable => hittable != null && hittable.isMove == false) .Subscribe(_ => { isMove = false; _tweenCore?.Kill(); CorrectPosition(); }) .AddTo(this); }
public void ShowMessage(string msg) { gameObject.SetActive(true); if (tweener != null) { tweener.Kill(); tweener = null; } if (coroutine != null) { StopCoroutine(coroutine); } canvasGroup.alpha = 1; text.text = msg; OnEnter(); coroutine = StartCoroutine(WaitHide()); }
public void RevokeBall() { if (m_ballState == BallState.Flying) { m_ballState = BallState.Revoking; m_tweener.Kill(); Vector3 pos = m_gun.transform.position; pos.x = transform.position.x; float distance = Vector3.Distance(transform.position, pos); m_tweener = transform.DOMove(pos, distance / m_flySpeed); //bay thẳng xuống cái đã m_tweener.SetEase(Ease.Linear); m_tweener.OnComplete(() => { FinishFly(); }); } }
private void StartMoveToTarget(Vector3 target) { if (isStunned) { return; } if (startGameManager.inSetup) { return; } start = transform.position; this.target = new Vector3(target.x, transform.position.y, target.z); startDist = Vector3.Distance(start, this.target); SetMoving(true); transform.LookAt(this.target); //TODO with sequence to lerp up then steady then down if (moveTween != null && moveTween.IsPlaying()) { moveTween.SetTarget(this.target); moveTween.ChangeValues(start, this.target, startDist / speed); } else { moveTween = transform.DOMove(this.target, startDist / speed); moveTween.OnUpdate(() => { var t = (Mathf.Sin(moveTween.ElapsedPercentage().Remap(0, 1, -Mathf.PI + Mathf.PI / 2, Mathf.PI + Mathf.PI / 2)) + 1) / 2.0f; animator.SetFloat("Speed", t); if (!isMoving || isStunned) { moveTween.Kill(); } }); moveTween.OnComplete(() => { SetMoving(false); }); moveTween.OnKill(() => { SetMoving(false); }); } }
private IEnumerator SpawnLoop() { TweenerCore <Quaternion, Vector3, QuaternionOptions> rotateLoop = null; TweenerCore <Vector3, Vector3, VectorOptions> scaleLoop = null; var sequance = DOTween.Sequence(); sequance.Join(transform.DOMove(_doTweenPopupSettings.GetMoveOffset() + transform.position, _doTweenPopupSettings.moveDuration).SetEase(_doTweenPopupSettings.moveCurve)); if (Math.Abs(_doTweenPopupSettings.GetRotateOffset()) > 0.01f) { rotateLoop = transform.DOLocalRotate( new Vector3(transform.localRotation.x, transform.localRotation.y, -_doTweenPopupSettings.GetRotateOffset()), _doTweenPopupSettings.rotateDuration) .SetEase(_doTweenPopupSettings.rotateCurve).SetLoops(-1, LoopType.Yoyo); } sequance.Join(_text.DOGradientColor(_doTweenPopupSettings.colorOverLifeTime, _doTweenPopupSettings.duration)); sequance.Join(_text.DOGradientAlpha(_doTweenPopupSettings.colorOverLifeTime, _doTweenPopupSettings.duration)); if (_doTweenPopupSettings.scaleOptions == ScaleOptions.ScaleBetweenTwoValue) { scaleLoop = transform.DOScale( _doTweenPopupSettings.scaleOptions == ScaleOptions.Constant ? _doTweenPopupSettings.GetScaleFactor().x : _doTweenPopupSettings.GetScaleFactor().y, _doTweenPopupSettings.scaleDuration) .SetEase(_doTweenPopupSettings.scaleCurve) .SetLoops(-1, LoopType.Yoyo); } yield return(new WaitForSeconds(_doTweenPopupSettings.duration)); rotateLoop?.Kill(); scaleLoop?.Kill(); sequance.Kill(); transform.rotation = Quaternion.identity; ReturnToPool(); }
public void Show(bool b) { if (IsShowMap == b) { return; } IsShowMap = b; if (mapAlphaTween != null) { mapAlphaTween.Kill(); } if (frontierColor != null) { frontierColor.Kill(); } if (cellAlphaTween != null) { cellAlphaTween.Kill(); } //为了防止行政图内部,不发生dirty,外部强制改下alpha值 if (TerrainGridSystem.colorizedTerritoriesAlpha == 0.0f) { TerrainGridSystem.colorizedTerritoriesAlpha = 0.01f; } else if (TerrainGridSystem.colorizedTerritoriesAlpha == 1.0f) { TerrainGridSystem.colorizedTerritoriesAlpha = 0.99f; } //tween地图颜色 mapAlphaTween = DOTween.To(() => TerrainGridSystem.colorizedTerritoriesAlpha, x => TerrainGridSystem.colorizedTerritoriesAlpha = x, b ? 0.6f : 0.0f, mapTweenDuration); mapAlphaTween.OnComplete(OnMapShowed); //tween地图边界 frontierColor = DOTween.ToAlpha(() => TerrainGridSystem.territoryDisputedFrontierColor, x => TerrainGridSystem.territoryDisputedFrontierColor = x, b ? 1.0f : 0.0f, mapTweenDuration); //tweenCell边界Alpha cellAlphaTween = DOTween.To(() => TerrainGridSystem.cellBorderAlpha, x => TerrainGridSystem.cellBorderAlpha = x, b ? 0.0f : 0.2f, mapTweenDuration); }
public override void OnPointerEnter(PointerEventData eventData) { if (IsSelected) { return; } if (!IsInteractable) { return; } if (RectTrans == null) { return; } if (vectorTween != null) { vectorTween.Kill(); } if (RectTrans != null) { vectorTween = DOTween.To(() => RectTrans.localScale, x => RectTrans.localScale = x, Enter, Duration).SetDelay(Delay); } }
/// <summary> /// Only Deactive UI wont clear Data. /// </summary> public virtual void Hide() { GameObject tempObj = null; if (m_ContentTrans != null) { tempObj = m_ContentTrans.gameObject; } else { tempObj = this.gameObject; } if (alphaBackground == UIAlphaBackground.DoAlpha) { if (bgImg != null) { if (tweenHideColor != null) { tweenHideColor.Kill(); } float p2 = 1; tweenHideColor = DOTween.To(() => p2, x => p2 = x, 0, 0.25f); tweenHideColor.SetEase(Ease.Linear); tweenHideColor.OnUpdate(() => { Color c = bgImg.color; c.a = p2; bgImg.color = c; }); } } if (this.mode == UIMode.DoTween && tempObj != null) { // DOTween.To (); if (tweenHideScale != null) { tweenHideScale.Kill(); } if (tweenHideScale1 != null) { tweenHideScale1.Kill(); } Vector3 p2 = Vector3.one; tweenHideScale = DOTween.To(() => p2, x => p2 = x, new Vector3(1.15f, 1.15f, 1), 0.08f); tweenHideScale.SetEase(Ease.InSine); tweenHideScale.OnUpdate(() => { //Debug.Log(p2); tempObj.transform.localScale = p2; }); tweenHideScale.OnComplete(() => { tweenHideScale1 = DOTween.To(() => p2, x => p2 = x, new Vector3(0, 0, 1), 0.17f); tweenHideScale1.SetEase(Ease.InOutSine); tweenHideScale1.OnUpdate(() => { tempObj.transform.localScale = p2; //Debug.Log(p2); }); tweenHideScale1.OnComplete(() => { this.gameObject.SetActive(false); isActived = false; //set this page's data null when hide. this.m_data = null; InvokeCloseAndRemoveAllListeners(); }); }); return; } //if (uiCurrency != null) //{ // uiCurrency.Hide(); //} this.gameObject.SetActive(false); isActived = false; //set this page's data null when hide. this.m_data = null; InvokeCloseAndRemoveAllListeners(); }
///Active this UI public virtual void Active() { this.transform.SetAsLastSibling(); this.gameObject.SetActive(true); isActived = true; GameObject tempObj = null; if (m_ContentTrans != null) { tempObj = m_ContentTrans.gameObject; } else { tempObj = this.gameObject; } if (alphaBackground == UIAlphaBackground.DoAlpha) { if (bgImg != null) { if (tweenShowColor != null) { tweenShowColor.Kill(); } float p2 = 0; tweenShowColor = DOTween.To(() => p2, x => p2 = x, 1, 0.28f); tweenShowColor.SetEase(Ease.Linear); tweenShowColor.OnUpdate(() => { Color c = bgImg.color; c.a = p2; bgImg.color = c; }); } } if (this.mode == UIMode.DoTween && tempObj != null) { if (tweenShowScale != null) { tweenShowScale.Kill(); } if (tweenShowScale1 != null) { tweenShowScale1.Kill(); } // DOTween.To (); Vector3 p2 = Vector3.zero; tweenShowScale = DOTween.To(() => p2, x => p2 = x, new Vector3(1.15f, 1.15f, 1), 0.12f); tweenShowScale.SetEase(Ease.InOutSine); tweenShowScale.OnUpdate(() => { //Debug.Log(p2); tempObj.transform.localScale = p2; }); tweenShowScale.OnComplete(() => { tweenShowScale1 = DOTween.To(() => p2, x => p2 = x, Vector3.one, 0.16f); tweenShowScale1.SetEase(Ease.InOutSine); tweenShowScale1.OnUpdate(() => { //Debug.Log(p2); tempObj.transform.localScale = p2; }); }); } //if (uiCurrency != null) //{ // uiCurrency.Active(); //} }