Track Percent Point 和 Track Head Point 重构优化 Note基础 特效框架(Effect Submodule 和 Effect基础类),将用于“时间触发型特效容器”与“Note特效容器“
66 lines
2.3 KiB
C#
66 lines
2.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Dreamteck.Splines;
|
|
using Ichni;
|
|
using Lean.Pool;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.RhythmGame
|
|
{
|
|
public partial class PathNode : BaseElement
|
|
{
|
|
public ColorSubmodule colorSubmodule;
|
|
|
|
public Track track;
|
|
public int index;
|
|
public SplinePoint node;
|
|
|
|
public static PathNode GeneratePathNode(string elementName, Track track, int index, Vector3 nodePosition,
|
|
Vector3 nodeNormal, float nodeSize, Color nodeColor)
|
|
{
|
|
PathNode pathNode = LeanPool.Spawn(EditorManager.instance.basePrefabs.pathNode, track.transform).GetComponent<PathNode>();
|
|
|
|
pathNode.NewInitialize(elementName, track, index, nodePosition, nodeNormal, nodeSize, nodeColor);
|
|
|
|
track.trackPathSubmodule.pathNodeList.Add(pathNode);
|
|
pathNode.SetParent(track);
|
|
return pathNode;
|
|
}
|
|
|
|
public void NewInitialize(string elementName, Track track, int index, Vector3 nodePosition,
|
|
Vector3 nodeNormal, float nodeSize, Color nodeColor)
|
|
{
|
|
base.NewInitialize(elementName);
|
|
this.track = track;
|
|
this.index = index;
|
|
|
|
this.transformSubmodule = new TransformSubmodule(nodePosition, Quaternion.LookRotation(nodeNormal, Vector3.up).eulerAngles, Vector3.one * nodeSize);
|
|
this.colorSubmodule = new ColorSubmodule(nodeColor);
|
|
|
|
Refresh();
|
|
}
|
|
|
|
public override void AfterInitialize()
|
|
{
|
|
Refresh();
|
|
if (track.trackPathSubmodule.pathNodeList.Count > 3)
|
|
{
|
|
track.trackPathSubmodule.ClosePath(track.trackPathSubmodule.isClosed);
|
|
}
|
|
}
|
|
}
|
|
|
|
public partial class PathNode
|
|
{
|
|
public override void Refresh()
|
|
{
|
|
Vector3 position = transformSubmodule.currentPosition;
|
|
Vector3 normal = Quaternion.Euler(transformSubmodule.currentEulerAngles) * Vector3.up;
|
|
float size = transformSubmodule.currentScale.x;
|
|
Color color = colorSubmodule.currentBaseColor;
|
|
|
|
node = new SplinePoint(position, Vector3.up, normal, size, color);
|
|
track.trackPathSubmodule.SetPathNode(this);
|
|
}
|
|
}
|
|
} |