Files
ichni_Creator_Studio/Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs

90 lines
3.2 KiB
C#
Raw Normal View History

2025-02-02 08:34:54 -05:00
using System;
using System.Collections;
using System.Collections.Generic;
2025-02-02 21:59:43 -05:00
using Ichni.RhythmGame.Beatmap;
using Lean.Pool;
using UnityEngine;
namespace Ichni.RhythmGame
{
2025-02-02 21:59:43 -05:00
public partial class TrackTotalTimeChange : AnimationBase
{
public FlexibleFloat totalTime;
public TrackTimeSubmoduleStatic targetTrackTimeSubmoduleStatic;
2025-02-02 21:59:43 -05:00
public static TrackTotalTimeChange GenerateElement(string elementName, Guid id,
List<string> tags, bool isFirstGenerated, Track animatedTrack, FlexibleFloat totalTime)
{
2025-02-02 21:59:43 -05:00
TrackTotalTimeChange trackTotalTimeChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject)
.AddComponent<TrackTotalTimeChange>();
2025-02-09 23:47:42 -05:00
trackTotalTimeChange.Initialize(elementName, id, tags, isFirstGenerated, animatedTrack);
2025-02-02 21:59:43 -05:00
trackTotalTimeChange.animatedObject = animatedTrack;
2025-02-02 21:59:43 -05:00
trackTotalTimeChange.targetTrackTimeSubmoduleStatic = animatedTrack.trackTimeSubmodule as TrackTimeSubmoduleStatic;
trackTotalTimeChange.totalTime = totalTime;
trackTotalTimeChange.animationReturnType = FlexibleReturnType.Before;
//trackTotalTimeChange.timeDurationSubmodule.SetDuration(totalTime);
2025-02-02 21:59:43 -05:00
return trackTotalTimeChange;
}
protected override void SetDefaultSubmodules()
{
timeDurationSubmodule = new TimeDurationSubmodule(this);
submoduleList.Add(timeDurationSubmodule);
}
protected override void UpdateAnimation(float songTime)
{
totalTime.UpdateFlexibleFloat(songTime);
2025-02-02 21:59:43 -05:00
if (totalTime.returnType == FlexibleReturnType.MiddleExecuting)
{
targetTrackTimeSubmoduleStatic.trackTotalTime = totalTime.value;
}
}
}
2025-02-02 21:59:43 -05:00
public partial class TrackTotalTimeChange
{
public override void SaveBM()
{
matchedBM = new TrackTotalTimeChange_BM(elementName, elementGuid, tags, animatedObject.matchedBM as Track_BM, totalTime.ConvertToBM());
2025-02-02 21:59:43 -05:00
}
}
namespace Beatmap
{
public class TrackTotalTimeChange_BM : GameElement_BM
2025-02-02 21:59:43 -05:00
{
public FlexibleFloat_BM totalTime;
public TrackTotalTimeChange_BM()
{
}
public TrackTotalTimeChange_BM(string elementName, Guid elementGuid, List<string> tags,
GameElement_BM attachedElement, FlexibleFloat_BM totalTime) :
base(elementName, elementGuid, tags, attachedElement)
2025-02-02 21:59:43 -05:00
{
this.totalTime = totalTime;
}
public override void ExecuteBM()
{
2025-02-08 23:09:50 -05:00
matchedElement = TrackTotalTimeChange.GenerateElement(elementName, elementGuid, tags, false,
2025-02-02 21:59:43 -05:00
GetElement(attachedElementGuid) as Track, totalTime.ConvertToGameType());
}
public override GameElement DuplicateBM(GameElement parent)
2025-02-02 21:59:43 -05:00
{
return TrackTotalTimeChange.GenerateElement(elementName, elementGuid, tags, false,
parent as Track, totalTime.ConvertToGameType());
2025-02-02 21:59:43 -05:00
}
}
}
}