修复倒播动画的问题
This commit is contained in:
parent
2c23d0d41c
commit
aed257f957
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user