超大量的更新 修复很多问题,gameplay特效初步
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
// 通过 PlayTween() 触发动画
|
||||
// Documentation text normalized.
|
||||
public class SimpleAxisTween : MonoBehaviour
|
||||
{
|
||||
public enum Axis { X, Y } // 轴向选项
|
||||
public enum Axis { X, Y } // Documentation text normalized.
|
||||
|
||||
[Header("Tween Settings")]
|
||||
public Axis axis = Axis.X; // 要缓动的轴
|
||||
public float from = 0f; // 起始值
|
||||
public float to = 100f; // 终点值
|
||||
public float duration = 1f; // 总时长(秒)——外部可调
|
||||
|
||||
public Axis axis = Axis.X; // Documentation text normalized.
|
||||
public float from = 0f;
|
||||
public float to = 0f;
|
||||
[Min(0.01f)] public float duration = 0.35f;
|
||||
|
||||
public AnimationCurve ease = AnimationCurve.EaseInOut(0, 0, 1, 1);
|
||||
|
||||
@@ -41,15 +40,15 @@ public class SimpleAxisTween : MonoBehaviour
|
||||
elapsed += Time.unscaledDeltaTime;
|
||||
float t = Mathf.Clamp01(elapsed / duration);
|
||||
float easedT = ease.Evaluate(t);
|
||||
float current = Mathf.Lerp(from, to, easedT);
|
||||
|
||||
// 缓动插值
|
||||
float current = Mathf.LerpUnclamped(from, to, easedT);
|
||||
// Documentation text normalized.
|
||||
SetPosition(current);
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 强制落在终点
|
||||
// Documentation text normalized.
|
||||
SetPosition(to);
|
||||
tweenCo = null;
|
||||
}
|
||||
@@ -71,4 +70,4 @@ public class SimpleAxisTween : MonoBehaviour
|
||||
transform.localPosition = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user