using System.Collections; using System.Collections.Generic; using Dreamteck.Splines; using Unity.VisualScripting; using UnityEngine; namespace Ichni.RhythmGame { public partial class TrackPathSubmodule : TrackSubmodule { public SplineComputer path; public List pathNodeList; public Track.TrackSpaceType trackSpaceType; public Track.TrackSamplingType trackSamplingType; public bool isClosed; public void NewInitialize(Track track, bool isClosed, Track.TrackSpaceType trackSpaceType, Track.TrackSamplingType trackSamplingType) { this.track = track; this.path = track.AddComponent(); track.trackPathSubmodule = this; this.pathNodeList = new List(); this.trackSpaceType = trackSpaceType; this.trackSamplingType = trackSamplingType; this.isClosed = isClosed; SetUpSplineComputer(trackSpaceType, trackSamplingType); } } public partial class TrackPathSubmodule { private void SetUpSplineComputer(Track.TrackSpaceType trackSpaceType, Track.TrackSamplingType trackSamplingType) { path.type = (Spline.Type)(int)trackSpaceType; path.sampleMode = (SplineComputer.SampleMode)(int)trackSamplingType; path.space = SplineComputer.Space.Local; } public void ClosePath(bool close) { if (close) { path.Close(); } else { path.Break(); } isClosed = close; } public void SetTrackSpaceType(int spaceType) { trackSpaceType = (Track.TrackSpaceType)spaceType; path.type = (Spline.Type)spaceType; } public void AddPathNode(PathNode point) { path.SetPoint(pathNodeList.Count, point.node, SplineComputer.Space.Local); pathNodeList.Add(point); } public void SetPathNode(PathNode point) { path.SetPoint(point.index, point.node, SplineComputer.Space.Local); } } }