@@ -32,7 +32,7 @@ namespace Ichni.RhythmGame
|
||||
public float trackTotalTime;
|
||||
public float visibleTrackTimeLength;
|
||||
public AnimationCurveType animationCurveType;
|
||||
|
||||
//public bool isGoWithZ = false;
|
||||
public TrackTimeSubmoduleMovable(Track track, float trackStartTime, float trackEndTime,
|
||||
float visibleTrackTimeLength, AnimationCurveType animationCurveType) : base(track)
|
||||
{
|
||||
@@ -61,8 +61,44 @@ namespace Ichni.RhythmGame
|
||||
public float GetTrackPercent(float songTimeInTime)
|
||||
{
|
||||
float per = AnimationCurveEvaluator.Evaluate(animationCurveType, (songTimeInTime - trackStartTime) / trackTotalTime);
|
||||
// return isGoWithZ ? GetSplineZPercent(Mathf.Clamp01(per)) : Mathf.Clamp01(per);
|
||||
return Mathf.Clamp01(per);
|
||||
}
|
||||
// private float GetSplineZPercent(float percent)
|
||||
// {
|
||||
// var nodeList = track.trackPathSubmodule.pathNodeList;
|
||||
// int count = nodeList.Count;
|
||||
// if (count <= 2) return percent;
|
||||
|
||||
// float startZ = nodeList[0].transformSubmodule.currentPosition.z;
|
||||
// float endZ = nodeList[count - 1].transformSubmodule.currentPosition.z;
|
||||
// float needZ = Mathf.Lerp(startZ, endZ, percent);
|
||||
|
||||
// float outpercent = 0f;
|
||||
// float percentBetween = 1f / (count - 1);
|
||||
|
||||
// for (int i = 0; i < count - 1; i++)
|
||||
// {
|
||||
// float z0 = nodeList[i].transformSubmodule.currentPosition.z;
|
||||
// float z1 = nodeList[i + 1].transformSubmodule.currentPosition.z;
|
||||
|
||||
// // 如果 needZ 在当前区间内,做插值
|
||||
// if ((z0 <= needZ && needZ <= z1) || (z1 <= needZ && needZ <= z0))
|
||||
// {
|
||||
// float zDelta = z1 - z0;
|
||||
// if (Mathf.Approximately(zDelta, 0f)) return outpercent;
|
||||
// float t = (needZ - z0) / zDelta;
|
||||
// outpercent += percentBetween * Mathf.Clamp01(t);
|
||||
// return outpercent;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// outpercent += percentBetween;
|
||||
// }
|
||||
// }
|
||||
// // 如果没找到区间,返回 1f(已遍历所有节点)
|
||||
// return 1f;
|
||||
// }
|
||||
|
||||
public override void Refresh()
|
||||
|
||||
@@ -101,6 +137,8 @@ namespace Ichni.RhythmGame
|
||||
var animationCurveDropdown =
|
||||
inspector.GenerateDropdown(this, trackTimeSubmoduleSettings, "Animation Curve", typeof(AnimationCurveType), nameof(animationCurveType))
|
||||
.AddListenerFunction(RefreshChildren);
|
||||
// var isGoWithZToggle =
|
||||
// inspector.GenerateToggle(this, trackTimeSubmoduleSettings, "Go With Z", nameof(isGoWithZ));
|
||||
var deleteButton = inspector.GenerateButton(this, trackTimeSubmoduleSettings, "Delete", () =>
|
||||
{
|
||||
Delete();
|
||||
|
||||
Reference in New Issue
Block a user