private void RenderDeathInfo() { deathInfoPanel.SetActive(true); TWAudioController.PlaySFX("SFX", "rating_appear"); int targetCount = GameTrackRate.DeathCount; int currentCount = -1; activeTween = DOVirtual.Float(0, targetCount, targetCount * timeCountPercentage, (time) => { if ((int)time != currentCount) { currentCount = (int)time; deathCount.text = ": " + currentCount; TWAudioController.PlaySFX("SFX", "rating_count_step"); } }).OnComplete(() => { activeTween = null; currentCount = targetCount; deathCount.text = ": " + currentCount; DOVirtual.DelayedCall(timePerStep, RenderItemScroll); }) .SetEase(Ease.Linear); }
void FinishWarp() { ShowBody(true); sword.parent = swordHand; sword.localPosition = swordOrigPos; sword.localEulerAngles = swordOrigRot; SkinnedMeshRenderer[] skinMeshList = GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer smr in skinMeshList) { GlowAmount(30); DOVirtual.Float(30, 0, .5f, GlowAmount); } Instantiate(hitParticle, sword.position, Quaternion.identity); target.GetComponentInParent <Animator>().SetTrigger("hit"); target.parent.DOMove(target.position + transform.forward, .5f); StartCoroutine(HideSword()); StartCoroutine(PlayAnimation()); StartCoroutine(StopParticles()); isLocked = false; LockInterface(false); aim.color = Color.clear; //Shake impulse.GenerateImpulse(Vector3.right); //Lens Distortion DOVirtual.Float(-80, 0, .2f, DistortionAmount); DOVirtual.Float(2f, 1, .1f, ScaleAmount); }
/// <summary> /// Animation in of the circle (from right to center) /// </summary> void DOMoveLevelIn(Action callback) { float width = Util.getWidth(); float height = Util.getHeight(); // show tutorial on first play if (Util.FirstPlay()) { DOVirtual.Float(+width * 1.5f, 0f, 0.3f, (float f) => { FindObjectOfType <GameLogic>().tutorialImage.rectTransform.anchoredPosition = new Vector3(f, 0, 0); }) .SetDelay(0.5f); } DOVirtual.Float(+width * 1.5f, 0f, 0.3f, (float f) => { FindObjectOfType <GameLogic>().diamondImage.rectTransform.anchoredPosition = new Vector3(f - width / 2.3f, height / 2.25f, 0); FindObjectOfType <GameLogic>().totalDiamondText.rectTransform.anchoredPosition = new Vector3(f - width / 2.3f + width / 6f, height / 2.25f, 0); }) .SetDelay(0.3f); DOVirtual.Float(+width * 1.5f, 0f, 0.3f, (float f) => { FindObjectOfType <GameLogic>().GetComponent <RectTransform>().anchoredPosition = new Vector3(f, 0, 0); }) .SetDelay(0.1f) .OnComplete(() => { if (callback != null) { callback(); } }); }
public void ChangeBloom(float to_value, float length) { DOVirtual.Float(_bloom.intensity.value, to_value, length, value => { _bloom.intensity.value = value; }); }
public void OnEvent(UIVirusAddLevelCoinEvent eventType) { var rt = transform as RectTransform; Vector2 pos = VirusTool.SceneToUguiPos(rt, eventType.WorldPos); var coin = PropPools.Instance.Spawn("Coin"); coin.transform.SetParent(coinParent); var rectTransform = coin.transform as RectTransform; rectTransform.localScale = Vector3.one; if (rectTransform != null) { rectTransform.anchoredPosition = pos; Vector2 e = _coinBg.anchoredPosition; Vector2 s = pos; Vector2 dir = Quaternion.Euler(0, 0, -90) * (e - s).normalized; float mul = Random.Range(0, 2) == 1 ? 1f : -1f; float t1 = Random.Range(0.3f, 0.5f); Vector2 mid = Vector2.Lerp(s, e, t1) + mul * dir * Random.Range(1.0f, 2.0f) * 100f; float dis = (e - s).magnitude; DOVirtual.Float(0, 10, dis / 1000f, (t) => { Vector2 p = VirusTool.GetBesselPoint(s, e, mid, t / 10f); rectTransform.anchoredPosition = p; }).OnComplete(() => { PropPools.Instance.DeSpawn(coin); _isLerp = true; VirusSoundMrg.Instance.PlaySound(VirusSoundType.LevelCoin); }); } }
void ShowBody(bool state) { foreach (SkinnedMeshRenderer smr in skinMeshList) { DOVirtual.Float(state ? -1 : 3f, state ? 3f : -1f, .5f, (value) => smr.material.SetFloat("_CutoffHeight", value)); } }
public void ChangeDepthOfField(float to_value, float length) { DOVirtual.Float(_depthOfField.focusDistance.value, to_value, length, value => { _depthOfField.focusDistance.value = value; }); }
public static void DoNumber(Text text, int startValue, int endValue, string fomat, float timeAnimationScale = 0.01f, string soundCount = "", string soundCompleted = "", TweenCallback onDone = null) { int nextValue = startValue; int tempValue = startValue; text.text = nextValue.ToString(); DOVirtual.Float(startValue, endValue, Mathf.Clamp(endValue * timeAnimationScale, 0.25f, 1.5f), (e) => { tempValue = Mathf.FloorToInt(e); if (tempValue != nextValue) { if (!string.IsNullOrEmpty(soundCount)) { SoundManager.Play(soundCount); } nextValue = tempValue; text.text = string.Format(fomat, nextValue); } }) .OnComplete(() => { if (!string.IsNullOrEmpty(soundCompleted)) { SoundManager.Play(soundCompleted); } text.text = string.Format(fomat, endValue); if (onDone != null) { onDone.Invoke(); } }); }
void Start() { DOVirtual.Float(0f, 100f, 3f, value => { text.text = "Count : " + (int)value; }); }
/// <summary> /// Open the buttons menu in the game /// </summary> void OnClickedSetting() { buttonSetting.enabled = false; float startvalue = 10; float endvalue = -43; if (gridLayoutGroup.spacing.y == -43) { startvalue = -43; endvalue = 10; buttonSetting.transform.DORotate(new Vector3(0, 0, 360), 1, RotateMode.FastBeyond360); } else { buttonSetting.transform.DORotate(new Vector3(0, 0, -360), 1, RotateMode.FastBeyond360); } DOVirtual.Float(startvalue, endvalue, 1, (float value) => { gridLayoutGroup.spacing = new Vector2(0, value); }).OnComplete(() => { buttonSetting.enabled = true; }); }
private Tween GenerateTweenSmoke(UITexture smokeTexture, float duration) { bool flag = DOTween.IsTweening(smokeTexture); if (flag) { DOTween.Kill(this, true); } Sequence sequence = TweenSettingsExtensions.SetId <Sequence>(DOTween.Sequence(), this); TweenSettingsExtensions.SetId <Sequence>(sequence, sequence); Sequence sequence2 = TweenSettingsExtensions.SetId <Sequence>(DOTween.Sequence(), this); Tween tween = DOVirtual.Float(0f, 1f, duration * 0.5f, delegate(float alpha) { smokeTexture.alpha = alpha; }); Tween tween2 = DOVirtual.Float(1f, 0f, duration * 0.5f, delegate(float alpha) { smokeTexture.alpha = alpha; }); TweenSettingsExtensions.Append(sequence2, tween); TweenSettingsExtensions.Append(sequence2, tween2); Tween tween3 = ShortcutExtensions.DOLocalMoveY(smokeTexture.get_transform(), smokeTexture.get_transform().get_localPosition().y + 10f, duration, false); TweenSettingsExtensions.Append(sequence, sequence2); TweenSettingsExtensions.Join(sequence, tween3); return(sequence); }
// SHOOTING void Shooting_Enter() { // enable gun gun.SetActive(true); // enable tower checking if (currentPlayer == Players.A) { playerBTowers.towerNumberChanged += OnTowerNumberChanged; playerATowers.towerNumberChanged -= OnTowerNumberChanged; } else { playerATowers.towerNumberChanged += OnTowerNumberChanged; playerBTowers.towerNumberChanged -= OnTowerNumberChanged; } // countdown DOVirtual.Float(ShootingRoundDuration, 0.0f, ShootingRoundDuration, (float val) => { scoreboard.setTime(0, (int)val); }).OnComplete(() => { sm.ChangeState(GameStates.ChooseCards); }).SetEase(Ease.Linear); }
public void UpdateValues() { var type = ScalerDataUtils.GetCurrentScalerType(); CameraScalerData currentData = data.Value[type]; if (currentData.useFov) { DOVirtual.Float( virtualCamera.m_Lens.FieldOfView, currentData.fov, transitionDuration, newValue => virtualCamera.m_Lens.FieldOfView = newValue).SetEase(Ease.InCirc); } if (currentData.usePosition) { if (useLocalPosition) { transform.DOLocalMove(currentData.offsetPosition, transitionDuration).SetEase(Ease.InCirc); } else { DOTween.To( () => cinemachineTransposer.m_FollowOffset, offset => cinemachineTransposer.m_FollowOffset = offset, currentData.offsetPosition, transitionDuration).SetEase(Ease.InCirc); } } }
private static int Float(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 4); float from = (float)LuaDLL.luaL_checknumber(L, 1); float to = (float)LuaDLL.luaL_checknumber(L, 2); float duration = (float)LuaDLL.luaL_checknumber(L, 3); LuaTypes luaTypes = LuaDLL.lua_type(L, 4); TweenCallback <float> onVirtualUpdate; if (luaTypes != LuaTypes.LUA_TFUNCTION) { onVirtualUpdate = (TweenCallback <float>)ToLua.CheckObject(L, 4, typeof(TweenCallback <float>)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 4); onVirtualUpdate = (DelegateFactory.CreateDelegate(typeof(TweenCallback <float>), func) as TweenCallback <float>); } Tweener o = DOVirtual.Float(from, to, duration, onVirtualUpdate); ToLua.PushObject(L, o); result = 1; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
private void TweenWaveWeight(float waveWeight) { DOVirtual.Float(waves._weight, waveWeight, tweenDuration, (f) => { waves._weight = f; }); }
public void SwitchToHome(Action onFinishedAnimation) { DOTween.Kill(this, false); TweenSettingsExtensions.SetId <Tweener>(DOVirtual.Float(0f, 1f, 0.3f, delegate(float alpha) { this.mPanelThis.alpha = alpha; }), this); this.mUIFurnitureYousei.Initialize(UIFurnitureYousei.YouseiType.Room); this.mUIFurnitureYousei.StartWalk(); this.mUIFurnitureYousei.get_transform().set_localPosition(Vector3.get_zero()); this.mUIFurnitureYousei.get_transform().set_localScale(Vector3.get_zero()); TweenSettingsExtensions.SetId <Tweener>(TweenSettingsExtensions.SetLoops <Tweener>(ShortcutExtensions.DOLocalMoveY(this.mUIFurnitureYousei.get_transform(), 12.5f, 0.2f, false), 30, 1), this); TweenSettingsExtensions.SetId <Tweener>(TweenSettingsExtensions.OnComplete <Tweener>(TweenSettingsExtensions.SetEase <Tweener>(ShortcutExtensions.DOScale(this.mUIFurnitureYousei.get_transform(), Vector3.get_one(), 0.6f), 15), delegate { TweenSettingsExtensions.SetId <Tweener>(TweenSettingsExtensions.SetDelay <Tweener>(ShortcutExtensions.DOScale(this.mUIFurnitureYousei.get_transform(), new Vector3(2f, 2f, 2f), 1f), 0.5f), this); TweenSettingsExtensions.SetId <Tweener>(TweenSettingsExtensions.OnComplete <Tweener>(TweenSettingsExtensions.SetEase <Tweener>(TweenSettingsExtensions.SetDelay <Tweener>(DOVirtual.Float(this.mUIFurnitureYousei.alpha, 0f, 0.6f, delegate(float alpha) { this.mUIFurnitureYousei.alpha = alpha; }), 0.5f), 18), delegate { TweenSettingsExtensions.SetId <Tweener>(DOVirtual.Float(1f, 0f, 0.3f, delegate(float alpha) { this.mPanelThis.alpha = alpha; }), this); if (onFinishedAnimation != null) { onFinishedAnimation.Invoke(); } }), this); }), this); }
public void ShowPanel() { ShowEndScore(); singleTweener?.Kill(); singleTweener = DOVirtual.Float(gameOverGroup.alpha, 1f, Config.TIME_FOR_SHOW_MENU_PANEL, (value) => gameOverGroup.alpha = value); gameOverGroup.blocksRaycasts = true; }
IEnumerator DashWait() { //GhostTrail[] ghosts = FindObjectsOfType<GhostTrail>(); //Array.ForEach<GhostTrail>(ghosts, g => g.ShowGhost()); //FindObjectOfType<GhostTrail>().ShowGhost(); ghost.ShowGhost(); StartCoroutine(GroundDash()); DOVirtual.Float(14, 0, .8f, RigidbodyDrag); //DOVirtual.Float(14, 0, .3f, RigidbodyDrag); //player.drag = 14; dashParticle.Play(); player.gravityScale = 0; GetComponent <BetterJump>().enabled = false; wallJumped = true; isDashing = true; yield return(new WaitForSeconds(0.05f)); DOVirtual.Float(0, defaultGravityScale, 0.1f, gravity); //player.AddForce(transform.right * 10, ForceMode2D.Impulse); yield return(new WaitForSeconds(.2f)); //player.AddForce(transform.right * 10, ForceMode2D.Impulse); //DOVirtual.Float(14, 0, .3f, RigidbodyDrag); player.gravityScale = defaultGravityScale; GetComponent <BetterJump>().enabled = true; wallJumped = false; isDashing = false; }
private void FinishWarp() { ShowBody(true); sword.parent = swordHand; sword.localPosition = swordOrigPos; sword.localEulerAngles = swordOrigRot; GlowAmount(30); DOVirtual.Float(30, 0, 0.5f, GlowAmount); //Auto Desotry Instantiate(hitParticle, sword.position, Quaternion.identity); target.GetComponentInParent <Animator>().SetTrigger(Hit_ID); target.parent.DOMove(target.position + transform.forward, 0.5f); StartCoroutine(HideSword()); StartCoroutine(PlayAnimation()); StartCoroutine(StopParticles()); impulse.GenerateImpulse(Vector3.right); DOVirtual.Float(-0.8f, 0, 0.2f, DistortionAmount); DOVirtual.Float(2f, 1f, 0.1f, ScaleAmount); }
public void StartState() { bool flag = this.mMst_bgm_jukebox.Bgm_flag == 1; if (flag) { this.mButton_Positive.SetState(UIButtonColor.State.Normal, true); this.mButton_Positive.set_enabled(true); this.mButton_Positive.isEnabled = true; } else { this.mButton_Positive.SetState(UIButtonColor.State.Disabled, true); this.mButton_Positive.set_enabled(false); this.mButton_Positive.isEnabled = false; } bool flag2 = DOTween.IsTweening(this); if (flag2) { DOTween.Kill(this, false); } TweenSettingsExtensions.SetId <Tweener>(DOVirtual.Float(this.mPanelThis.alpha, 1f, 0.3f, delegate(float alpha) { this.mPanelThis.alpha = alpha; }), this); this.mUIJukeBoxMusicPlayingRollLabel.StartRoll(); Tween tween = this.GenerateTweenYouseiSwing(); Tween tween2 = this.GenerateTweenYouseiMarch(); Tween tween3 = this.GenerateTweenYouseiMove(); }
public void ChangeVignette(float to_value, float length) { DOVirtual.Float(_vignette.roundness.value, to_value, length, value => { _vignette.roundness.value = value; }); }
void Aim(bool state, bool changeCamera, float delay) { if (walking) { return; } aiming = state; animator.SetBool("aiming", aiming); //UI float fade = state ? 1 : 0; reticle.DOFade(fade, .2f); if (!changeCamera) { return; } //Camera Offset float newAim = state ? cameraZoomOffset : 0; float originalAim = !state ? cameraZoomOffset : 0; DOVirtual.Float(originalAim, newAim, .5f, CameraOffset).SetDelay(delay); }
void MaskFalse() { Camera.main.transform.DOComplete(); Camera.main.transform.DOShakePosition(0.1f, 2f, 14, 90, false, true); DOVirtual.Float(0.50f, 0.15f, 0.1f, ca.intensity.Override).OnComplete(DestroyVolume); this.GetComponent <SpriteMask>().enabled = false; }
void Boost(bool state) { if (state) { cameraParent.GetComponentInChildren <CinemachineImpulseSource>().GenerateImpulse(); trail.Play(); circle.Play(); } else { trail.Stop(); circle.Stop(); } trail.GetComponent <TrailRenderer>().emitting = state; float origFov = state ? 40 : 55; float endFov = state ? 55 : 40; float origChrom = state ? 0 : 1; float endChrom = state ? 1 : 0; float origDistortion = state ? 0 : -30; float endDistorton = state ? -30 : 0; float starsVel = state ? -20 : -1; float speed = state ? forwardSpeed * 2 : forwardSpeed; float zoom = state ? -7 : 0; DOVirtual.Float(origChrom, endChrom, .5f, Chromatic); DOVirtual.Float(origFov, endFov, .5f, FieldOfView); DOVirtual.Float(origDistortion, endDistorton, .5f, DistortionAmount); var pvel = stars.velocityOverLifetime; pvel.z = starsVel; DOVirtual.Float(dolly.m_Speed, speed, .15f, SetSpeed); SetCameraZoom(zoom, .4f); }
public void Warp() { GameObject clone = Instantiate(gameObject, transform.position, transform.rotation); Destroy(clone.GetComponent <WarpController>().sword.gameObject); Destroy(clone.GetComponent <Animator>()); Destroy(clone.GetComponent <WarpController>()); Destroy(clone.GetComponent <MovementInput>()); Destroy(clone.GetComponent <CharacterController>()); SkinnedMeshRenderer[] skinMeshList = clone.GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer smr in skinMeshList) { smr.material = glowMaterial; smr.material.DOFloat(2, "_AlphaThreshold", 5f).OnComplete(() => Destroy(clone)); } ShowBody(false); anim.speed = 0; transform.DOMove(target.position, warpDuration).SetEase(Ease.InExpo).OnComplete(() => FinishWarp()); sword.parent = null; sword.DOMove(target.position, warpDuration / 1.2f); sword.DOLookAt(target.position, .2f, AxisConstraint.None); //Particles blueTrail.Play(); whiteTrail.Play(); //Lens Distortion DOVirtual.Float(0, -80, .2f, DistortionAmount); DOVirtual.Float(1, 2f, .2f, ScaleAmount); }
public void Focus() { DOTween.Kill(this); mSprite_Yousei.spriteName = "mini_08_a_01"; mButton_Menu.SetState(UIButtonColor.State.Hover, immediate: true); Sequence sequence = DOTween.Sequence(); Tween t = mSprite_Yousei.transform.DOLocalMoveY(50f, 0.3f); Tween t2 = DOVirtual.Float(mSprite_Yousei.fillAmount, 1f, 0.3f, delegate(float percentage) { mSprite_Yousei.fillAmount = percentage; }); Tween t3 = DOVirtual.Float(0.2f, 1f, 0.3f, delegate(float percentage) { mTexture_Area.alpha = percentage; }); mTexture_Area.transform.localScale = new Vector3(0.1f, 0.1f); Tween t4 = mTexture_Area.transform.DOScale(Vector3.one, 0.1f).SetEase(Ease.OutExpo); sequence.Append(t); sequence.Join(t2); sequence.Join(t3); sequence.Join(t4); sequence.OnComplete(delegate { DOVirtual.Float(1f, 0.5f, 1.5f, delegate(float percentage) { mTexture_Area.alpha = percentage; }).SetId(this).SetLoops(int.MaxValue, LoopType.Yoyo) .SetEase(Ease.OutCirc); }); sequence.SetId(this); }
public override void OnSelectAnimation(Action onAnimationFinished) { Sequence sequence = DOTween.Sequence(); UISprite spriteFormation = Util.Instantiate(this.mSprite_Formation.get_gameObject(), base.get_transform().get_gameObject(), false, false).GetComponent <UISprite>(); spriteFormation.get_transform().set_localScale(this.mSprite_Formation.get_transform().get_localScale()); spriteFormation.get_transform().set_localPosition(this.mSprite_Formation.get_transform().get_localPosition()); Tween tween = DOVirtual.Float(spriteFormation.alpha, 0f, 1f, delegate(float alpha) { spriteFormation.alpha = alpha; }); Tween tween2 = ShortcutExtensions.DOScale(spriteFormation.get_transform(), new Vector3(1.5f, 1.5f), 1f); this.mTexture_Background_Circle.get_transform().localScale(new Vector3(0.3f, 0.3f)); ShortcutExtensions.DOScale(this.mTexture_Background_Circle.get_transform(), Vector3.get_one(), 0.3f); Tween tween3 = DOVirtual.Float(0f, 1f, 0.3f, delegate(float alpha) { this.mTexture_Background_Circle.alpha = alpha; }); Tween tween4 = ShortcutExtensions.DOScale(this.mTexture_Background_Circle.get_transform(), Vector3.get_one(), 0.3f); TweenSettingsExtensions.SetEase <Tween>(tween4, 27); TweenCallback tweenCallback = delegate { if (onAnimationFinished != null) { onAnimationFinished.Invoke(); } }; TweenSettingsExtensions.OnComplete <Sequence>(TweenSettingsExtensions.AppendInterval(TweenSettingsExtensions.Join(TweenSettingsExtensions.Append(sequence, tween3), tween4), 1f), tweenCallback); }
//Switch with cases for the different states the game can be in, taking in an Enum for which mode to use, see above public void ChangeVolume(Mode modeToEnable) { switch (modeToEnable) { case Mode.nonKinematic: //Interpolate the volume transition using DOTween's DOVirtual method DOVirtual.Float(kinematicVolume.weight, 0, .2f, KinematicVolumeWeight).SetUpdate(true).SetEase(Ease.InOutSine); break; case Mode.kinematic: DOVirtual.Float(kinematicVolume.weight, 1, .2f, KinematicVolumeWeight).SetUpdate(true).SetEase(Ease.InOutSine); break; case Mode.customGravity: nonKinematicColorCurves.active = true; break; case Mode.standardGravity: nonKinematicColorCurves.active = false; break; case Mode.timescale: DOVirtual.Float(nonKinematicColorAdj.saturation.value, -80, .2f, NonKinematicSaturation).SetUpdate(true).SetEase(Ease.InOutSine); break; case Mode.defaultTimeScale: DOVirtual.Float(nonKinematicColorAdj.saturation.value, 5, .2f, NonKinematicSaturation).SetUpdate(true).SetEase(Ease.InOutSine); break; } }
IEnumerator DashWait() { // Graphics effect for trail FindObjectOfType <GhostTrail>().ShowGhost(); // Resets dash right away if on ground StartCoroutine(GroundDash()); // Changes drag over time DOVirtual.Float(14, 0, .8f, SetRigidbodyDrag); // Stop gravity rb.gravityScale = 0; // Disable better jumping script GetComponent <BetterJumping>().enabled = false; wallJumped = true; isDashing = true; // Wait for dash to end yield return(new WaitForSeconds(.3f)); // Reset gravity rb.gravityScale = 3; // Turn better jumping back on GetComponent <BetterJumping>().enabled = true; wallJumped = false; isDashing = false; }
private void ClearDOF() { DOVirtual.Float(0f, 10, clearDOFTime, (x) => { dof.focusDistance.value = x; }); }