基础内容
必要插件安装 缓动曲线和动画基础 ElementFolder,Track与其次级模块,PathNode重构
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class TrackTimeSubmodule : TrackSubmodule
|
||||
{
|
||||
public float headPercent, tailPercent;
|
||||
}
|
||||
|
||||
public class TrackTimeSubmoduleMovable : TrackTimeSubmodule
|
||||
{
|
||||
public float trackStartTime;
|
||||
public float trackEndTime;
|
||||
public float trackTotalTime;
|
||||
public float visibleTrackTimeLength;
|
||||
public AnimationCurveType animationCurveType;
|
||||
|
||||
public void NewInitialize(Track track, float trackStartTime, float trackEndTime,
|
||||
float visibleTrackTimeLength, AnimationCurveType animationCurveType)
|
||||
{
|
||||
this.track = track;
|
||||
this.track.trackTimeSubmodule = this;
|
||||
this.trackStartTime = trackStartTime;
|
||||
this.trackEndTime = trackEndTime;
|
||||
this.trackTotalTime = trackEndTime - trackStartTime;
|
||||
this.visibleTrackTimeLength = visibleTrackTimeLength;
|
||||
this.animationCurveType = animationCurveType;
|
||||
track.timeDurationSubmodule.startTime = trackStartTime;
|
||||
track.timeDurationSubmodule.endTime = trackEndTime + visibleTrackTimeLength;
|
||||
}
|
||||
|
||||
public void UpdateTrackPart()
|
||||
{
|
||||
float songTime = EditorManager.instance.songModule.songTime;
|
||||
|
||||
headPercent = GetTrackPercent(songTime);
|
||||
tailPercent = GetTrackPercent(songTime - visibleTrackTimeLength);
|
||||
|
||||
Debug.Log("Head: " + headPercent + " Tail: " + tailPercent);
|
||||
|
||||
if (track.trackRendererSubmodule != null)
|
||||
{
|
||||
track.trackRendererSubmodule.meshGenerator.clipFrom = tailPercent;
|
||||
track.trackRendererSubmodule.meshGenerator.clipTo = headPercent;
|
||||
}
|
||||
}
|
||||
|
||||
private float GetTrackPercent(float songTimeInTime)
|
||||
{
|
||||
float per = AnimationCurveEvaluator.Evaluate(animationCurveType, (songTimeInTime - trackStartTime) / trackTotalTime);
|
||||
return Mathf.Clamp01(per);
|
||||
}
|
||||
}
|
||||
|
||||
public class TrackTimeSubmoduleStatic : TrackTimeSubmodule
|
||||
{
|
||||
public float trackTotalTime;
|
||||
public AnimationCurveType animationCurveType;
|
||||
|
||||
public void NewInitialize(Track track, float trackTotalTime, AnimationCurveType animationCurveType)
|
||||
{
|
||||
this.track = track;
|
||||
this.track.trackTimeSubmodule = this;
|
||||
this.trackTotalTime = trackTotalTime;
|
||||
this.animationCurveType = animationCurveType;
|
||||
this.headPercent = 0;
|
||||
this.tailPercent = 1;
|
||||
track.timeDurationSubmodule.startTime = 0;
|
||||
track.timeDurationSubmodule.endTime = 0;
|
||||
//timeDurationSubmodule 根据下辖Note的时间来设置
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user