using System; using System.Collections; using Convention; using UnityEngine; namespace Demo.Game { public abstract class BasicSplineJustFollow : Updatement { public SplineCore MySplineCore; protected override float Lerp(float begin, float end, float t) { return Mathf.Lerp(begin, end, t); } protected override abstract void UpdateData(float data); public override IEnumerator LoadScript(string script) { yield return base.LoadScript(script); } public override IEnumerator UnloadScript() { MySplineCore = null; yield return base.UnloadScript(); } /// /// 新增 /// /// 插值时间 /// /// 可取值为30种缓动曲线 [Convention.RScript.Variable.Attr.Method] public void Add(string time, string value, string curveType) { ManualAddEntry(time, float.Parse(value), Enum.Parse(curveType)); } /// /// 如未加载则加载,然后绑定到样条线 /// /// 脚本位置 [Convention.RScript.Variable.Attr.Method] public IEnumerator Load(string path) { MySplineCore = FindWithPath(path, false) as SplineCore; if (MySplineCore == null) { yield return DoLoadSubScriptAsync(nameof(SplineCore), path, x => { MySplineCore = x as SplineCore; }); } } } }