基础内容
必要插件安装 缓动曲线和动画基础 ElementFolder,Track与其次级模块,PathNode重构
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user