基础内容-5
主题包; 测试NoteVisual与NoteEffect; LookAt旋转动画与FlexibleBool 动画杂项 控制台初步
This commit is contained in:
43
Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs
Normal file
43
Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class TrackTotalTimeChange : AnimationBase
|
||||
{
|
||||
public FlexibleFloat totalTime;
|
||||
public TrackTimeSubmoduleStatic targetTrackTimeSubmoduleStatic;
|
||||
|
||||
public static TrackTotalTimeChange GenerateElement(string elementName, Track targetTrack, FlexibleFloat totalTime)
|
||||
{
|
||||
TrackTotalTimeChange trackTotalTimeChange = LeanPool.Spawn(EditorManager.instance.basePrefabs.emptyObject).AddComponent<TrackTotalTimeChange>();
|
||||
trackTotalTimeChange.NewInitialize(elementName, targetTrack);
|
||||
|
||||
if (targetTrack.trackTimeSubmodule is TrackTimeSubmoduleStatic submoduleStatic)
|
||||
{
|
||||
trackTotalTimeChange.targetTrackTimeSubmoduleStatic = submoduleStatic;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("Target object does not have a TrackTimeSubmoduleStatic");
|
||||
}
|
||||
|
||||
trackTotalTimeChange.totalTime = totalTime;
|
||||
trackTotalTimeChange.animationReturnType = FlexibleReturnType.Before;
|
||||
trackTotalTimeChange.SetTimeDuration(totalTime);
|
||||
return trackTotalTimeChange;
|
||||
}
|
||||
|
||||
protected override void UpdateAnimation(float songTime)
|
||||
{
|
||||
totalTime.UpdateFlexibleFloat(songTime);
|
||||
|
||||
if (totalTime.returnType == FlexibleReturnType.MiddleExecuting)
|
||||
{
|
||||
targetTrackTimeSubmoduleStatic.trackTotalTime = totalTime.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user