From aed257f95707c932d9141244fbc1ca4dfaeb531f Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 14 Jan 2025 10:16:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=80=92=E6=92=AD=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Resources/PointQuestion/Point3D.prefab | 2 +- Assets/Scripts/Actions/AnimationAction.cs | 26 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Assets/Resources/PointQuestion/Point3D.prefab b/Assets/Resources/PointQuestion/Point3D.prefab index 182e0947..3fc4cd43 100644 --- a/Assets/Resources/PointQuestion/Point3D.prefab +++ b/Assets/Resources/PointQuestion/Point3D.prefab @@ -73,7 +73,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 0 + m_SortingOrder: 1 m_Sprite: {fileID: 21300000, guid: 700820383005de14fba6008141269066, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 diff --git a/Assets/Scripts/Actions/AnimationAction.cs b/Assets/Scripts/Actions/AnimationAction.cs index dedeaf82..d22a624f 100644 --- a/Assets/Scripts/Actions/AnimationAction.cs +++ b/Assets/Scripts/Actions/AnimationAction.cs @@ -1,3 +1,4 @@ +using DG.Tweening; using System; using System.Collections.Generic; using UnityEngine; @@ -81,12 +82,29 @@ namespace QFramework { float.TryParse(speed, out curSpeed); } - anim[animName].speed = curSpeed; - anim.Play(animName); - if (anim[animName].wrapMode== WrapMode.Loop) + + if (curSpeed < 0) { - this.Finish(); + anim.Play(animName); + anim[animName].normalizedTime = 1; + DOTween.To(() => anim[animName].normalizedTime, v => anim[animName].normalizedTime = v, 0, anim[animName].length / Math.Abs(curSpeed)).onComplete = () => + { + anim.Stop(); + }; } + else + { + anim[animName].speed = curSpeed; + + anim.Play(animName); + + if (anim[animName].wrapMode == WrapMode.Loop) + { + this.Finish(); + } + } + + } } catch (Exception)