public void Remove() { if (m_used) { return; } POIInfo.Stop(); POIInfo = Tweener.Start(new FloatTweenSettings { duration = 1f, from = 0, to = 1, easing = Interpolations.Sinusoidal.InOut, onChanged = (amt) => { transform.localPosition = Vector3.Lerp(transform.localPosition, transform.localPosition + new Vector3(0, 0, 0.0002f), amt); transform.eulerAngles = Vector3.Lerp(transform.eulerAngles, transform.eulerAngles + new Vector3(0, 0, -360f), amt); }, onFinished = (amt) => { GetComponent <Rigidbody>().isKinematic = false; m_used = true; m_gameState.AddScrew(); } }, this); }
/// <summary> /// Cancels an existing tween that is being updated. /// </summary> /// <param name="info">Reference to the tween.</param> private void CancelTween(TweenInfo info) { if (_tweenInfos.Contains(info)) { _tweenInfos.Remove(info); } }
// Stops while iterating inversely, which deals better with tweens that overwrite each other static void StopPreview(List <DOTweenAnimation> keys) { for (int i = keys.Count - 1; i > -1; --i) { DOTweenAnimation anim = keys[i]; TweenInfo tInfo = _AnimationToTween[anim]; if (tInfo.isFrom) { int totLoops = tInfo.tween.Loops(); if (totLoops < 0 || totLoops > 1) { tInfo.tween.Goto(tInfo.tween.Duration(false)); } else { tInfo.tween.Complete(); } } else { tInfo.tween.Rewind(); } tInfo.tween.Kill(); EditorUtility.SetDirty(anim); // Refresh views _AnimationToTween.Remove(anim); } }
public void UpdateValue(float clampedValue) { if (!IsPlaying) { return; } CurDuration += TweenInfo.IgnoreTimeScale ? Time.unscaledDeltaTime : Time.deltaTime; if (CurDuration > TweenInfo.Duration) { CurDuration = TweenInfo.Duration; } float diff = TweenInfo.To - TweenInfo.From; float delta = diff * clampedValue; Value = TweenInfo.From + delta; if (TweenInfo.Callback == null) { Debug.LogWarning("Callback did not set"); } else { TweenInfo.Callback(Value, clampedValue == 1); } }
protected override void DoTween(float normalized_time) { Vector3 rot = RectTrans.localRotation.eulerAngles; TweenInfo ti = TweenList[0]; if (ti != null && ti.IsEnabled) { rot.x = InterpolateValue(normalized_time, ti); } ti = TweenList[1]; if (ti != null && ti.IsEnabled) { rot.y = InterpolateValue(normalized_time, ti); } ti = TweenList[2]; if (ti != null && ti.IsEnabled) { rot.z = InterpolateValue(normalized_time, ti); } RectTrans.localRotation = Quaternion.Euler(rot); }
void DrawInfo(TweenInfo twInfo) { bool hasId = twInfo.tween.id != ""; string s = "Id: " + (hasId ? twInfo.tween.id : "-") + ", Loops: " + twInfo.tween.completedLoops + "/" + twInfo.tween.loops; GUILayout.Label(s, HOGUIStyle.LabelSmallStyle); }
public GTweenUIScale() { TweenList = new TweenInfo[2]; for (int i = 0; i < TweenList.Length; i++) { TweenList[i] = new TweenInfo(); } }
public GTweenUIRot() { TweenList = new TweenInfo[3]; for (int i = 0; i < TweenList.Length; i++) { TweenList[i] = new TweenInfo(); } }
/// <summary> /// Starts a tween. /// </summary> /// <param name="onUpdate">Update callback invoked evert frame the tween is active.</param> /// <param name="duration">Duration of the tween in seconds.</param> /// <returns></returns> private TweenInfo StartTween(Action <float> onUpdate, float duration) { TweenInfo info = new TweenInfo(onUpdate); info.Duration = duration; _tweenInfos.Add(info); return(info); }
public void OpenDoor() { m_openDoor.Stop(); m_openDoor = Tweener.Start(new FloatTweenSettings { duration = 2f, from = 0, to = 1, easing = Interpolations.Linear, onChanged = (amt) => { transform.position = Vector3.Lerp(transform.position, transform.position - new Vector3(0.33f, 0, 0), amt); } }, this); }
protected override void DoTween(float normalized_time) { float val_a = 1; TweenInfo ti = TweenList[0]; if (ti != null && ti.IsEnabled) { val_a = InterpolateValue(normalized_time, ti); } if (_target != null) { _target.alpha = val_a; } }
protected virtual void HideAnnotation() { m_annotationInfo.Stop(); m_annotationInfo = Tweener.Start(new FloatTweenSettings { duration = 1f, from = 1, to = 0.2f, easing = Interpolations.Sinusoidal.InOut, onChanged = (amt) => { m_annotation.GetComponent <CanvasGroup>().alpha = amt; m_text.alpha = amt; }, }, this); }
static void StopPreview(Tween t) { TweenInfo tInfo = null; foreach (KeyValuePair <DOTweenAnimation, TweenInfo> kvp in _AnimationToTween) { if (kvp.Value.tween != t) { continue; } tInfo = kvp.Value; _AnimationToTween.Remove(kvp.Key); break; } if (tInfo == null) { Debug.LogWarning("DOTween Preview ► Couldn't find tween to stop"); return; } if (tInfo.isFrom) { int totLoops = tInfo.tween.Loops(); if (totLoops < 0 || totLoops > 1) { tInfo.tween.Goto(tInfo.tween.Duration(false)); } else { tInfo.tween.Complete(); } } else { tInfo.tween.Rewind(); } tInfo.tween.Kill(); EditorUtility.SetDirty(tInfo.animation); // Refresh views if (_AnimationToTween.Count == 0) { StopAllPreviews(); } else { InternalEditorUtility.RepaintAllViews(); } }
public virtual void GetGrabbed(Transform grabber) { GrabAction(grabber); m_transformInfo.Stop(); m_transformInfo = Tweener.Start(new FloatTweenSettings { duration = 0.5f, from = 0, to = 1, easing = Interpolations.Sinusoidal.InOut, onChanged = (amt) => { transform.position = Vector3.Lerp(transform.position, grabber.position, amt); transform.forward = Vector3.Lerp(transform.forward, grabber.forward, amt); } }, this); }
void DrawTargetButtons(TweenInfo twInfo, TweenGroup twGroup) { if (GUILayout.Button(twGroup == TweenGroup.Running ? "Pause" : "Play", HOGUIStyle.BtTinyStyle, GUILayout.Width(45))) { if (twGroup == TweenGroup.Running) { twInfo.tween.Pause(); } else { twInfo.tween.Play(); } } if (GUILayout.Button("Kill", HOGUIStyle.BtTinyStyle, GUILayout.Width(32))) { twInfo.tween.Kill(); } }
protected override void DoTween(float normalized_time) { Vector2 pos = Vector2.zero; TweenInfo ti = TweenList[0]; if (ti != null && ti.IsEnabled) { pos.x = InterpolateValue(normalized_time, ti); } ti = TweenList[1]; if (ti != null && ti.IsEnabled) { pos.y = InterpolateValue(normalized_time, ti); } RectTrans.anchoredPosition = pos + BasePos; }
protected override void DoTween(float normalized_time) { Vector3 scale = RectTrans.localScale; TweenInfo ti = TweenList[0]; if (ti != null) { scale.x = InterpolateValue(normalized_time, ti); } ti = TweenList[1]; if (ti != null && ti.IsEnabled) { scale.y = InterpolateValue(normalized_time, ti); } RectTrans.localScale = scale; }
protected float InterpolateValue(float normalized_time, TweenInfo ti) { float ip_value = 0; if (ti.TweenType == TweenType.Curv) { ip_value = ti.AnimCurv.Evaluate(normalized_time) * (ti.EndValue - ti.StartValue) + ti.StartValue; } else { ip_value = normalized_time * (ti.EndValue - ti.StartValue) + ti.StartValue; } if (_InverseCurve) { ip_value = 1 - ip_value; } return(ip_value); }
// =================================================================================== // METHODS --------------------------------------------------------------------------- void DrawTarget(TweenInfo twInfo, object twTarget, TweenGroup twGroup, bool isSequenced) { GUILayout.BeginHorizontal(); if (isSequenced) { GUILayout.Space(9); } if (GUILayout.Button(twTarget.ToString(), HOGUIStyle.BtLabelStyle)) { SelectTargetGameObject(twTarget); } if (!isSequenced && twGroup != TweenGroup.Disabled) { DrawTargetButtons(twInfo, twGroup); } GUILayout.EndHorizontal(); if (!isSequenced && twGroup != TweenGroup.Disabled) { DrawInfo(twInfo); } }
/// <summary> /// 初始化默认配置 /// </summary> public void InitDefaultInfo() { TerrainMakerDefine.DefaultTerrainInfo defaultTerrainInfo = m_Root.Define.CurrentDefaultTerrainInfo; m_ResourcePathInfo = defaultTerrainInfo.ResourcePathInfo.Clone() as ResourcePathInfo; m_GameObjectPathInfo = defaultTerrainInfo.GameObjectPathInfo.Clone() as GameObjectPathInfo; m_BuildingInfo = defaultTerrainInfo.BuildingInfo.Clone() as BuildingInfo; m_GamePlayInfo = defaultTerrainInfo.GamePlayInfo.Clone() as GamePlayInfo; m_TweenInfo = defaultTerrainInfo.TweenInfo.Clone() as TweenInfo; m_ColorInfo = defaultTerrainInfo.ColorInfo.Clone() as ColorInfo; m_SceneArtInfo = defaultTerrainInfo.SceneArtInfo.Clone() as SceneArtInfo; LogHelper.Trace?.Log("TerrainMakerTool", "InitDefaultInfo.", LogHelper.Object2String(m_ResourcePathInfo), LogHelper.Object2String(m_GameObjectPathInfo), LogHelper.Object2String(m_BuildingInfo), LogHelper.Object2String(m_GamePlayInfo), LogHelper.Object2String(m_TweenInfo), LogHelper.Object2String(m_ColorInfo), LogHelper.Object2String(m_SceneArtInfo) ); }
/// <summary> /// Updates all existing tweens. /// </summary> private void UpdateTweens() { for (int i = _tweenInfos.Count - 1; i >= 0; i--) { TweenInfo info = _tweenInfos[i]; if (info.Delay > 0.0f) { info.Delay -= Time.unscaledDeltaTime; continue; } // Advance the time. info.Time += Time.unscaledDeltaTime; // Compute the normalized time. float t = this.ComputeNormalizedTime(info.Time, info.Duration, info.Ease); // Invoke custom updaters. if (info.OnUpdate != null) { info.OnUpdate(t); } // Check if the tween has finished. if (info.Time >= info.Duration) { if (info.OnComplete != null) { info.OnComplete(); } _tweenInfos.RemoveAt(i); } } }
public void Open() { if (m_used) { return; } POIInfo.Stop(); POIInfo = Tweener.Start(new FloatTweenSettings { duration = 1f, from = 0, to = 1, easing = Interpolations.Sinusoidal.InOut, onChanged = (amt) => { m_pivot.localEulerAngles = Vector3.Lerp(m_pivot.localEulerAngles, new Vector3(0, 0, 60f), amt); }, onFinished = (amt) => { m_used = true; } }, this); }
/// <summary> /// Move object to given location in given time /// Replaces any current movements /// </summary> /// <param name="location">Location.</param> /// <param name="inTime">In time.</param> /// <param name="space">World or local space (default = local)</param> public void MoveTo( Vector3 location, float inTime, Space space = Space.Self ) { StopCoroutine( "Move" ); var tweenInfo = new TweenInfo( inTime, space ); tweenInfo.targetPos = location; StartCoroutine( "Move", tweenInfo ); }
IEnumerator Rotate( TweenInfo tween ) { rotating = true; var startRot = tween.space == Space.Self ? transform.localRotation : transform.rotation; float amount = 0; while ( amount < 1f ) { amount += Time.deltaTime / tween.tweenTime; var rotateTo = Quaternion.Lerp( startRot, tween.targetRot, amount ); if ( tween.space == Space.Self ) transform.localRotation = rotateTo; else transform.rotation = rotateTo; if ( amount >= 1f ) break; yield return 0; } if ( FinishedRotation != null ) FinishedRotation(); rotating = false; FinishedAction(); }
IEnumerator Move( TweenInfo tween ) { moving = true; var startPos = tween.space == Space.Self ? transform.localPosition : transform.position; float amount = 0; while ( amount < 1f ) { amount += Time.deltaTime / tween.tweenTime; var moveTo = Vector3.Lerp( startPos, tween.targetPos, amount ); if ( tween.space == Space.Self ) transform.localPosition = moveTo; else transform.position = moveTo; if ( amount >= 1f ) break; yield return 0; } if ( FinishedMove != null ) FinishedMove(); moving = false; FinishedAction(); }
/// <summary> /// Rotate object to given rotation in given time /// Replaces any current rotations /// </summary> /// <param name="rotation">Rotation.</param> /// <param name="inTime">In time.</param> /// <param name="space">World or local space (default = local)</param> public void RotateTo( Quaternion rotation, float inTime, Space space = Space.Self ) { StopCoroutine( "Rotate" ); var tweenInfo = new TweenInfo( inTime, space ); tweenInfo.targetRot = rotation; StartCoroutine( "Rotate", tweenInfo ); }
public GTweenUIFill() { TweenList = new TweenInfo[1]; TweenList[0] = new TweenInfo(); }
/// <summary> /// 创建默认配置 /// </summary> private void __CreateDefaultTerrainInfo() { //资源路径 if (m_CurrentDefaultTerrainInfo.ResourcePathInfo == null) { ResourcePathInfo resourcePathInfo = new ResourcePathInfo(); resourcePathInfo.TerrainPath = "Prefab/Terrain"; resourcePathInfo.TerrainPiecePath = "Prefab/TerrainPiece"; m_CurrentDefaultTerrainInfo.ResourcePathInfo = resourcePathInfo; } if (m_CurrentDefaultTerrainInfo.GameObjectPathInfo == null) { GameObjectPathInfo gameObjectPathInfo = new GameObjectPathInfo(); gameObjectPathInfo.PieceMaterialPath = "Cube"; gameObjectPathInfo.SideRootPath = "Side"; gameObjectPathInfo.SideMaterialPath = "Tag"; gameObjectPathInfo.DownPath = "Down"; gameObjectPathInfo.UpPath = "Up"; gameObjectPathInfo.BuildingRootPath = "Building"; m_CurrentDefaultTerrainInfo.GameObjectPathInfo = gameObjectPathInfo; } //建筑 if (m_CurrentDefaultTerrainInfo.BuildingInfo == null) { BuildingInfo buildingInfo = new BuildingInfo(); //地块大小 buildingInfo.TerrainSize = new Vector3(); buildingInfo.TerrainSize.x = 4; buildingInfo.TerrainSize.y = 1; buildingInfo.TerrainSize.z = 4; //间隔 buildingInfo.IntervalSize = new Vector3(); buildingInfo.IntervalSize.x = 1; buildingInfo.IntervalSize.y = 1.6f; buildingInfo.IntervalSize.z = 1; //地块方向块偏移值 (从中心点到边缘的方向) buildingInfo.SideShiftingValue = 0.35f; m_CurrentDefaultTerrainInfo.BuildingInfo = buildingInfo; } //玩法 if (m_CurrentDefaultTerrainInfo.GamePlayInfo == null) { GamePlayInfo gamePlayInfo = new GamePlayInfo(); gamePlayInfo.BirthLogicPosition = Vector3.zero; gamePlayInfo.HasEndLogicPosition = false; gamePlayInfo.EndLoigcPosition = Vector3.zero; m_CurrentDefaultTerrainInfo.GamePlayInfo = gamePlayInfo; } //动画 if (m_CurrentDefaultTerrainInfo.TweenInfo == null) { TweenInfo tweenInfo = new TweenInfo(); tweenInfo.Originate = 8; tweenInfo.MoveSpeed = 1.8f; m_CurrentDefaultTerrainInfo.TweenInfo = tweenInfo; } //颜色 if (m_CurrentDefaultTerrainInfo.ColorInfo == null) { ColorInfo colorInfo = new ColorInfo(); colorInfo.Floor_Current = new Color(1, 1, 1, 1); colorInfo.Floor_Other = new Color(0.8f, 0.8f, 0.8f, 0.29f); colorInfo.Piece_Current = new Color(1, 1, 1, 1); colorInfo.Piece_ArriveAround = new Color(0.75f, 0.78f, 0.79f, 1); colorInfo.Piece_Other = new Color(0.75f, 0.78f, 0.79f, 1); colorInfo.Piece_End = new Color(0.82f, 0.3f, 0.3f, 1); colorInfo.Side_Current = new Color(0.36f, 0.33f, 0.3f, 1); colorInfo.Side_Other = new Color(0.37f, 0.38f, 0.35f, 1); m_CurrentDefaultTerrainInfo.ColorInfo = colorInfo; } //场景表现 if (m_CurrentDefaultTerrainInfo.SceneArtInfo == null) { SceneArtInfo sceneArtInfo = new SceneArtInfo(); //首层3200 到3000可以容纳40层,应该是满足扩展的。 sceneArtInfo.FirstFloorShaderLayer = 3200; //每个层预留5个shader层级单位 // 0 = 扩展层 // -1 = player // -2 = building // -3 = pieceSide // -4 = piece sceneArtInfo.FloorShaderLayerInterval = 5; m_CurrentDefaultTerrainInfo.SceneArtInfo = sceneArtInfo; } }
public GTweenUIAlpha() { TweenList = new TweenInfo[1]; TweenList[0] = new TweenInfo(); }
private void ResolvePresent(TweenDepot depot, IPuzzle puzzle, IOperation origin, IOperation op, float delay) { IQuad[] rowQuads = puzzle.GetRowQuads(op.row); if ((op.direction & QuadValue.Left) > 0) { for (int i = op.column - 1; i >= 0; i--) { // 左舷依次翻转 IQuad quad = rowQuads[i]; float qdelay = (Mathf.Abs(quad.column - op.column) - 1) * Style.QuadRollDelay; if (quad.value == QuadValue.Block) { DOTween.Sequence().AppendInterval(delay + qdelay) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles + new Vector3(0, Style.QuadShakeAngle, 0), Style.QuadShakeDuration * 0.25f)) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles + new Vector3(0, -Style.QuadShakeAngle, 0), Style.QuadShakeDuration * 0.25f)) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles, Style.QuadShakeDuration * 0.5f) .SetEase(Ease.OutBack)); break; } else if ((quad.value & (QuadValue.Left | QuadValue.Right | QuadValue.Up | QuadValue.Down)) > 0) { VisionSpark spark = new VisionSpark(VisionSparkType.Sprinkle); spark.delay = delay + qdelay; quad.Spark(spark); ResolvePresent(depot, puzzle, origin, new Operation(OpType.TouchClick, quad.row, quad.column, quad.value), delay + qdelay + Style.QuadRollDuration); break; } else { string tid = Style.QuadUnifiedRotateId + "_" + quad.row + "_" + quad.column; TweenInfo lt = depot.GetFirst(tid); if (lt != null && Mathf.Abs(lt.atPosition - delay - qdelay) < Style.QuadRollDuration) { lt.Kill(); Tweener t = DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, new Vector3(0, 0, Style.QuadConflictAngle), Style.QuadConflictDuration) .SetEase(Ease.OutBack) .SetRelative(); depot.Add(delay + qdelay, t); } else { Tweener t = DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, new Vector3(0, Style.QuadRollAngle, 0), Style.QuadRollDuration) .SetId(tid) .SetEase(Ease.OutBack) .SetRelative(); depot.Add(delay + qdelay, t); } } } } if ((op.direction & QuadValue.Right) > 0) { for (int i = op.column + 1, len = rowQuads.Length; i < len; i++) { // 右舷依次翻转 IQuad quad = rowQuads[i]; float qdelay = (Mathf.Abs(quad.column - op.column) - 1) * Style.QuadRollDelay; if (quad.value == QuadValue.Block) { DOTween.Sequence().AppendInterval(delay + qdelay) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles + new Vector3(0, -Style.QuadShakeAngle, 0), Style.QuadShakeDuration * 0.25f)) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles + new Vector3(0, Style.QuadShakeAngle, 0), Style.QuadShakeDuration * 0.25f)) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles, Style.QuadShakeDuration * 0.5f) .SetEase(Ease.OutBack)); break; } else if ((quad.value & (QuadValue.Left | QuadValue.Right | QuadValue.Up | QuadValue.Down)) > 0) { VisionSpark spark = new VisionSpark(VisionSparkType.Sprinkle); spark.delay = delay + qdelay; quad.Spark(spark); ResolvePresent(depot, puzzle, origin, new Operation(OpType.TouchClick, quad.row, quad.column, quad.value), delay + qdelay + Style.QuadRollDuration); break; } else { string tid = Style.QuadUnifiedRotateId + "_" + quad.row + "_" + quad.column; TweenInfo lt = depot.GetFirst(tid); if (lt != null && Mathf.Abs(lt.atPosition - delay - qdelay) < Style.QuadRollDuration) { lt.Kill(); Tweener t = DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, new Vector3(0, 0, -Style.QuadConflictAngle), Style.QuadConflictDuration) .SetEase(Ease.OutBack) .SetRelative(); depot.Add(delay + qdelay, t); } else { Tweener t = DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, new Vector3(0, -Style.QuadRollAngle, 0), Style.QuadRollDuration) .SetId(tid) .SetEase(Ease.OutBack) .SetRelative(); depot.Add(delay + qdelay, t); } } } } IQuad[] columnQuads = puzzle.GetColumnQuads(op.column); if ((op.direction & QuadValue.Up) > 0) { for (int i = op.row - 1; i >= 0; i--) { // 上侧依次翻转 IQuad quad = columnQuads[i]; float qdelay = (Mathf.Abs(quad.row - op.row) - 1) * Style.QuadRollDelay; if (quad.value == QuadValue.Block) { DOTween.Sequence().AppendInterval(delay + qdelay) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles + new Vector3(-Style.QuadShakeAngle, 0, 0), Style.QuadShakeDuration * 0.25f)) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles + new Vector3(Style.QuadShakeAngle, 0, 0), Style.QuadShakeDuration * 0.25f)) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles, Style.QuadShakeDuration * 0.5f) .SetEase(Ease.OutBack)); break; } else if ((quad.value & (QuadValue.Left | QuadValue.Right | QuadValue.Up | QuadValue.Down)) > 0) { VisionSpark spark = new VisionSpark(VisionSparkType.Sprinkle); spark.delay = delay + qdelay; quad.Spark(spark); ResolvePresent(depot, puzzle, origin, new Operation(OpType.TouchClick, quad.row, quad.column, quad.value), delay + qdelay + Style.QuadRollDuration); break; } else { string tid = Style.QuadUnifiedRotateId + "_" + quad.row + "_" + quad.column; TweenInfo lt = depot.GetFirst(tid); if (lt != null && Mathf.Abs(lt.atPosition - delay - qdelay) < Style.QuadRollDuration) { lt.Kill(); Tweener t = DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, new Vector3(0, 0, Style.QuadConflictAngle), Style.QuadConflictDuration) .SetEase(Ease.OutBack) .SetRelative(); depot.Add(delay + qdelay, t); } else { Tweener t = DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, new Vector3(-Style.QuadRollAngle, 0, 0), Style.QuadRollDuration) .SetId(tid) .SetEase(Ease.OutBack) .SetRelative(); depot.Add(delay + qdelay, t); } } } } if ((op.direction & QuadValue.Down) > 0) { for (int i = op.row + 1, len = columnQuads.Length; i < len; i++) { // 下侧依次翻转 IQuad quad = columnQuads[i]; float qdelay = (Mathf.Abs(quad.row - op.row) - 1) * Style.QuadRollDelay; if (quad.value == QuadValue.Block) { DOTween.Sequence().AppendInterval(delay + qdelay) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles + new Vector3(Style.QuadShakeAngle, 0, 0), Style.QuadShakeDuration * 0.25f)) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles + new Vector3(-Style.QuadShakeAngle, 0, 0), Style.QuadShakeDuration * 0.25f)) .Append(DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, quad.localEulerAngles, Style.QuadShakeDuration * 0.5f) .SetEase(Ease.OutBack)); break; } else if ((quad.value & (QuadValue.Left | QuadValue.Right | QuadValue.Up | QuadValue.Down)) > 0) { VisionSpark spark = new VisionSpark(VisionSparkType.Sprinkle); spark.delay = delay + qdelay; quad.Spark(spark); ResolvePresent(depot, puzzle, origin, new Operation(OpType.TouchClick, quad.row, quad.column, quad.value), delay + qdelay + Style.QuadRollDuration); break; } else { string tid = Style.QuadUnifiedRotateId + "_" + quad.row + "_" + quad.column; TweenInfo lt = depot.GetFirst(tid); if (lt != null && Mathf.Abs(lt.atPosition - delay - qdelay) < Style.QuadRollDuration) { lt.Kill(); Tweener t = DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, new Vector3(0, 0, -Style.QuadConflictAngle), Style.QuadConflictDuration) .SetEase(Ease.OutBack) .SetRelative(); depot.Add(delay + qdelay, t); } else { Tweener t = DOTween.To(() => quad.localEulerAngles, x => quad.localEulerAngles = x, new Vector3(Style.QuadRollAngle, 0, 0), Style.QuadRollDuration) .SetId(tid) .SetEase(Ease.OutBack) .SetRelative(); depot.Add(delay + qdelay, t); } } } } }