98 lines
3.1 KiB
C#
98 lines
3.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Ichni.RhythmGame.Beatmap;
|
|
using Lean.Pool;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.RhythmGame
|
|
{
|
|
public partial class Track : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule
|
|
{
|
|
public TransformSubmodule transformSubmodule { get; set; }
|
|
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
|
public TrackPathSubmodule trackPathSubmodule { get; set; }
|
|
public TrackTimeSubmodule trackTimeSubmodule { get; set; }
|
|
public TrackRendererSubmodule trackRendererSubmodule { get; set; }
|
|
|
|
public static Track GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated, GameElement parentElement)
|
|
{
|
|
Track track = Instantiate(EditorManager.instance.basePrefabs.track, parentElement.transform).GetComponent<Track>();
|
|
|
|
track.Initialize(elementName, id, tags, isFirstGenerated, parentElement);
|
|
|
|
return track;
|
|
}
|
|
|
|
protected override void SetDefaultSubmodules()
|
|
{
|
|
transformSubmodule = new TransformSubmodule(this);
|
|
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
|
trackPathSubmodule = null;
|
|
trackTimeSubmodule = null;
|
|
trackRendererSubmodule = null;
|
|
|
|
submoduleList.Add(transformSubmodule);
|
|
submoduleList.Add(timeDurationSubmodule);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (timeDurationSubmodule.CheckTimeInDuration(EditorManager.instance.songInformation.songTime))
|
|
{
|
|
(trackTimeSubmodule as TrackTimeSubmoduleMovable)?.UpdateTrackPart();
|
|
}
|
|
}
|
|
}
|
|
|
|
public partial class Track
|
|
{
|
|
public override void SaveBM()
|
|
{
|
|
matchedBM = new Beatmap.Track_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM);
|
|
}
|
|
}
|
|
|
|
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 : GameElement_BM
|
|
{
|
|
public Track_BM()
|
|
{
|
|
|
|
}
|
|
|
|
public Track_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement)
|
|
: base(elementName, elementGuid, tags, attachedElement)
|
|
{
|
|
|
|
}
|
|
|
|
public override void ExecuteBM()
|
|
{
|
|
matchedElement = Track.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid));
|
|
}
|
|
|
|
public override GameElement DuplicateBM(GameElement parent)
|
|
{
|
|
return Track.GenerateElement(elementName, elementGuid, tags, false, parent);
|
|
}
|
|
}
|
|
}
|
|
} |