@@ -12,10 +12,10 @@ namespace Ichni.RhythmGame
|
||||
public float startValue, endValue; //起止值
|
||||
public float startTime, endTime; //起止时间
|
||||
public AnimationCurveType animationCurveType; //动画曲线类型
|
||||
|
||||
|
||||
public float differenceValue => endValue - startValue; //差值
|
||||
public float totalTime => endTime - startTime; //总时间
|
||||
|
||||
|
||||
|
||||
public AnimatedFloat(float startTime, float endTime, float startValue, float endValue,
|
||||
AnimationCurveType animationCurveType)
|
||||
@@ -26,7 +26,7 @@ namespace Ichni.RhythmGame
|
||||
this.endTime = endTime;
|
||||
this.animationCurveType = animationCurveType;
|
||||
}
|
||||
|
||||
|
||||
public void ApplyTimeOffset(float offset)
|
||||
{
|
||||
startTime += offset;
|
||||
@@ -79,8 +79,8 @@ namespace Ichni.RhythmGame
|
||||
/// <param name="歌曲时间"></param>
|
||||
public void UpdateFlexibleFloat(float nowTime)
|
||||
{
|
||||
if(isSwitchingReturnType) isSwitchingReturnType = false;
|
||||
|
||||
if (isSwitchingReturnType) isSwitchingReturnType = false;
|
||||
|
||||
AnimatedFloat nowAnimatedFloat = GetAnimatedFloat(nowTime); //获取当前时间点对应的AnimatedFloat
|
||||
if (nowAnimatedFloat != null) //如果能获取到,表明当前时间点存在动画
|
||||
{
|
||||
@@ -88,11 +88,11 @@ namespace Ichni.RhythmGame
|
||||
float nowPercent = AnimationCurveEvaluator.Evaluate(nowAnimatedFloat.animationCurveType,
|
||||
(nowTime - nowAnimatedFloat.startTime) / nowAnimatedFloat.totalTime);
|
||||
value = nowAnimatedFloat.startValue + nowPercent * nowAnimatedFloat.differenceValue; //计算value
|
||||
|
||||
|
||||
returnType = FlexibleReturnType.MiddleExecuting;
|
||||
if (lastReturnType != returnType) isSwitchingReturnType = true;
|
||||
lastReturnType = returnType;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Ichni.RhythmGame
|
||||
returnType = FlexibleReturnType.Before;
|
||||
if (lastReturnType != returnType) isSwitchingReturnType = true;
|
||||
lastReturnType = returnType;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,10 +131,10 @@ namespace Ichni.RhythmGame
|
||||
returnType = FlexibleReturnType.After;
|
||||
if (lastReturnType != returnType) isSwitchingReturnType = true;
|
||||
lastReturnType = returnType;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
SetLateAnimatedFloat(nowTime); //如果当前时间点在动画之间,设置currentAnimationIndex
|
||||
if (currentAnimationIndex >= 0) //如果当前时间点在动画之间
|
||||
{
|
||||
value = animations[currentAnimationIndex].endValue;
|
||||
@@ -143,7 +143,7 @@ namespace Ichni.RhythmGame
|
||||
returnType = FlexibleReturnType.MiddleInterval;
|
||||
if (lastReturnType != returnType) isSwitchingReturnType = true;
|
||||
lastReturnType = returnType;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,15 +171,27 @@ namespace Ichni.RhythmGame
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
void SetLateAnimatedFloat(float nowTime)
|
||||
{
|
||||
for (int i = 0; i < animations.Count - 1; i++)
|
||||
{
|
||||
if (nowTime >= animations[i].startTime && nowTime <= animations[i + 1].startTime)
|
||||
{
|
||||
currentAnimationIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转换为Beatmap存档类型
|
||||
/// </summary>
|
||||
public FlexibleFloat_BM ConvertToBM()
|
||||
{
|
||||
FlexibleFloat_BM flexibleFloat_BM = new FlexibleFloat_BM();
|
||||
|
||||
|
||||
foreach (AnimatedFloat animatedFloat in animations)
|
||||
{
|
||||
flexibleFloat_BM.animatedFloatList.Add(new AnimatedFloat(animatedFloat.startTime, animatedFloat.endTime,
|
||||
|
||||
Reference in New Issue
Block a user