2025-09-25 19:04:05 +08:00
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
2025-12-16 17:54:51 +08:00
|
|
|
using System.IO;
|
2025-09-25 19:04:05 +08:00
|
|
|
using Convention;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Demo.Game
|
|
|
|
|
{
|
2025-12-16 17:54:51 +08:00
|
|
|
namespace ConfigType
|
2025-09-25 19:04:05 +08:00
|
|
|
{
|
2025-12-16 17:54:51 +08:00
|
|
|
public class BasicSplineJustFollowConfig : ScriptLoadableConfig
|
|
|
|
|
{
|
|
|
|
|
public int MySplineCore;
|
|
|
|
|
public override void Deserialize(BinaryReader reader)
|
|
|
|
|
{
|
|
|
|
|
MySplineCore = BinarySerializeUtility.ReadInt(reader);
|
|
|
|
|
base.Deserialize(reader);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Serialize(BinaryWriter writer)
|
|
|
|
|
{
|
|
|
|
|
BinarySerializeUtility.WriteInt(writer, MySplineCore);
|
|
|
|
|
base.Serialize(writer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public abstract class BasicSplineJustFollow : Updatement<float>, IDependOnSplineCore
|
|
|
|
|
{
|
|
|
|
|
public SplineCore MySplineCore { get; set; }
|
2025-09-25 19:04:05 +08:00
|
|
|
|
|
|
|
|
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 UnloadScript()
|
|
|
|
|
{
|
|
|
|
|
MySplineCore = null;
|
|
|
|
|
yield return base.UnloadScript();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="time">插值时间</param>
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
/// <param name="curveType">可取值为30种缓动曲线</param>
|
2025-10-27 20:24:15 +08:00
|
|
|
[Convention.RScript.Variable.Attr.Method]
|
2025-11-25 10:52:39 +08:00
|
|
|
public void Add(float time, float value, MathExtension.EaseCurveType curveType)
|
2025-09-25 19:04:05 +08:00
|
|
|
{
|
2025-11-25 10:52:39 +08:00
|
|
|
ManualAddEntry(time, value, curveType);
|
2025-09-25 19:04:05 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|