基础内容

必要插件安装
缓动曲线和动画基础
ElementFolder,Track与其次级模块,PathNode重构
This commit is contained in:
SoulliesOfficial
2025-01-26 21:10:16 -05:00
parent 40f63dd2bd
commit 8d0abec75f
9320 changed files with 2950357 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
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<PathNode> 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<SplineComputer>();
track.trackPathSubmodule = this;
this.pathNodeList = new List<PathNode>();
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);
}
}
}