102 lines
3.1 KiB
C#
102 lines
3.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Lean.Pool;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.RhythmGame
|
|
{
|
|
public partial class Track : BaseElement
|
|
{
|
|
public TrackPathSubmodule trackPathSubmodule;
|
|
public TrackTimeSubmodule trackTimeSubmodule;
|
|
public TrackRendererSubmodule trackRendererSubmodule;
|
|
|
|
public static Track GenerateElement(string elementName, Guid id, List<string> tags,
|
|
BaseElement parent, Vector3 position)
|
|
{
|
|
Track track = Instantiate(EditorManager.instance.basePrefabs.track, parent.transform).GetComponent<Track>();
|
|
|
|
track.Initialize(elementName, id, tags);
|
|
track.SetParent(parent);
|
|
|
|
track.transformSubmodule = new TransformSubmodule(track, position, Vector3.zero, Vector3.one);
|
|
track.timeDurationSubmodule = new TimeDurationSubmodule(track);
|
|
|
|
track.trackPathSubmodule = null;
|
|
track.trackTimeSubmodule = null;
|
|
track.trackRendererSubmodule = null;
|
|
|
|
track.SetTransformObserver();
|
|
|
|
return track;
|
|
}
|
|
|
|
public override void AfterInitialize()
|
|
{
|
|
base.AfterInitialize();
|
|
submoduleList.Add(trackPathSubmodule);
|
|
submoduleList.Add(trackTimeSubmodule);
|
|
submoduleList.Add(trackRendererSubmodule);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (timeDurationSubmodule.CheckTimeInDuration(EditorManager.instance.songModule.songTime))
|
|
{
|
|
(trackTimeSubmodule as TrackTimeSubmoduleMovable)?.UpdateTrackPart();
|
|
}
|
|
}
|
|
}
|
|
|
|
public partial class Track
|
|
{
|
|
public override void SaveBM()
|
|
{
|
|
matchedBM = new Beatmap.Track_BM(elementName, elementGuid, tags, parentElement.matchedBM);
|
|
}
|
|
}
|
|
|
|
public partial class Track
|
|
{
|
|
public enum TrackSpaceType
|
|
{
|
|
CatmullRom = 0,
|
|
BSpline = 1,
|
|
Linear = 3
|
|
}
|
|
|
|
public enum TrackSamplingType
|
|
{
|
|
TimeDistributed = 0,
|
|
DistanceDistributed = 1
|
|
}
|
|
}
|
|
|
|
namespace Beatmap
|
|
{
|
|
public class Track_BM : BaseElement_BM
|
|
{
|
|
public Track_BM()
|
|
{
|
|
|
|
}
|
|
|
|
public Track_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement)
|
|
: base(elementName, elementGuid, tags, attachedElement)
|
|
{
|
|
|
|
}
|
|
|
|
public override void ExecuteBM()
|
|
{
|
|
matchedElement = Track.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), Vector3.zero);
|
|
}
|
|
|
|
public override BaseElement DuplicateBM(BaseElement parent)
|
|
{
|
|
return Track.GenerateElement(elementName, elementGuid, tags, parent, Vector3.zero);
|
|
}
|
|
}
|
|
}
|
|
} |