2025-02-07 16:05:13 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
2025-11-18 11:27:53 +08:00
|
|
|
namespace AlicizaX.AnimationFlow.Runtime
|
|
|
|
|
{
|
2025-02-07 16:05:13 +08:00
|
|
|
[Category("Animation")]
|
2025-11-18 11:27:53 +08:00
|
|
|
public class ScaleTo : AnimationBaseNode<Vector3>
|
|
|
|
|
{
|
2025-02-07 16:05:13 +08:00
|
|
|
public Transform target;
|
|
|
|
|
|
2025-11-18 11:27:53 +08:00
|
|
|
public override void OnInit()
|
|
|
|
|
{
|
2025-02-07 16:05:13 +08:00
|
|
|
orgValue = target.localScale;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-11-18 11:27:53 +08:00
|
|
|
public override void OnReset()
|
|
|
|
|
{
|
2025-02-07 16:05:13 +08:00
|
|
|
target.localScale = orgValue;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:27:53 +08:00
|
|
|
public override void OnEnter()
|
|
|
|
|
{
|
|
|
|
|
if (setFrom)
|
|
|
|
|
{
|
2025-02-07 16:05:13 +08:00
|
|
|
target.localScale = from;
|
|
|
|
|
}
|
2025-11-18 11:27:53 +08:00
|
|
|
|
2025-02-07 16:05:13 +08:00
|
|
|
enterValue = target.localScale;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:27:53 +08:00
|
|
|
public override void OnUpdate(float dt)
|
|
|
|
|
{
|
2025-02-07 16:05:13 +08:00
|
|
|
target.localScale = Easing.Ease(easyType, enterValue, to, elapsedTime / duration);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:27:53 +08:00
|
|
|
public override bool Valid()
|
|
|
|
|
{
|
2025-02-07 16:05:13 +08:00
|
|
|
return target != null && duration > 0;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:27:53 +08:00
|
|
|
public override float Duration()
|
|
|
|
|
{
|
2025-02-07 16:05:13 +08:00
|
|
|
return duration;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:27:53 +08:00
|
|
|
public override bool HasSubTitle()
|
|
|
|
|
{
|
2025-02-07 16:05:13 +08:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:27:53 +08:00
|
|
|
public override string SubTitle()
|
|
|
|
|
{
|
2025-02-07 16:05:13 +08:00
|
|
|
return target != null ? target.name : null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|