PathNode移除自带Transform和Color
This commit is contained in:
@@ -31,6 +31,8 @@ namespace Ichni.RhythmGame
|
||||
public List<BaseElement> childElementList = new List<BaseElement>();
|
||||
|
||||
//次级模块
|
||||
public List<SubmoduleBase> submoduleList = new List<SubmoduleBase>();
|
||||
|
||||
public TimeDurationSubmodule timeDurationSubmodule;
|
||||
public TransformSubmodule transformSubmodule;
|
||||
public ColorSubmodule colorSubmodule;
|
||||
@@ -55,7 +57,7 @@ namespace Ichni.RhythmGame
|
||||
/// </summary>
|
||||
public virtual void AfterInitialize()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -40,15 +40,21 @@ namespace Ichni
|
||||
new FlexibleFloat(new List<AnimatedFloat>() { new(0, 2, 0, 1, AnimationCurveType.OutQuad) }));
|
||||
var tr0 = Trail.GenerateElement("Trail-0", Guid.NewGuid(), new List<string>(), pp0, 5);
|
||||
// t0.trackRendererSubmodule = new TrackRendererSubmoduleAutoOrient(t0);
|
||||
var p0 = PathNode.GenerateElement("PathNode-0", Guid.NewGuid(), new List<string>(), t0,
|
||||
new Vector3(-5, 5, 10), Vector3.forward, 1, Color.white);
|
||||
var p1 = PathNode.GenerateElement("PathNode-1", Guid.NewGuid(), new List<string>(), t0,
|
||||
new Vector3(5, -5, 10), Vector3.forward, 0, Color.red);
|
||||
var p0 = PathNode.GenerateElement("PathNode-0", Guid.NewGuid(), new List<string>(), t0);
|
||||
p0.transformSubmodule = new TransformSubmodule(p0, new Vector3(-5, 5, 10), Vector3.forward, Vector3.one);
|
||||
p0.colorSubmodule = new ColorSubmodule(p0, Color.white);
|
||||
var p1 = PathNode.GenerateElement("PathNode-1", Guid.NewGuid(), new List<string>(), t0);
|
||||
p1.transformSubmodule = new TransformSubmodule(p1, new Vector3(5, -5, 10), Vector3.forward, Vector3.one);
|
||||
p1.colorSubmodule = new ColorSubmodule(p1, Color.red);
|
||||
var n0 = Tap.GenerateElement("Note-0", Guid.NewGuid(), new List<string>(), 1f, t0);
|
||||
var n0v = BasicNoteVisual.GenerateElement("Note-0-V", Guid.NewGuid(), new List<string>(), "basic",
|
||||
"BasicNoteTap3D", Vector3.zero, Vector3.zero, Vector3.one, n0);
|
||||
|
||||
elementList.ForEach(e => e.AfterInitialize());
|
||||
elementList.ForEach(e =>
|
||||
{
|
||||
e.AfterInitialize();
|
||||
e.Refresh();
|
||||
});
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
||||
@@ -19,8 +19,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public SplinePoint node;
|
||||
|
||||
public static PathNode GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
Track track, Vector3 nodePosition, Vector3 nodeNormal, float nodeSize, Color nodeColor)
|
||||
public static PathNode GenerateElement(string elementName, Guid id, List<string> tags, Track track)
|
||||
{
|
||||
PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform)
|
||||
.GetComponent<PathNode>();
|
||||
@@ -29,10 +28,9 @@ namespace Ichni.RhythmGame
|
||||
pathNode.track = track;
|
||||
//pathNode.index = index;
|
||||
|
||||
pathNode.transformSubmodule = new TransformSubmodule(pathNode, nodePosition,
|
||||
Quaternion.LookRotation(nodeNormal, Vector3.up).eulerAngles, Vector3.one * nodeSize);
|
||||
pathNode.transformSubmodule = new TransformSubmodule(pathNode);
|
||||
pathNode.timeDurationSubmodule = new TimeDurationSubmodule(pathNode);
|
||||
pathNode.colorSubmodule = new ColorSubmodule(pathNode, nodeColor);
|
||||
pathNode.colorSubmodule = new ColorSubmodule(pathNode);
|
||||
|
||||
track.trackPathSubmodule.pathNodeList.Add(pathNode);
|
||||
pathNode.SetParent(track);
|
||||
@@ -58,6 +56,10 @@ namespace Ichni.RhythmGame
|
||||
Vector3 normal = Quaternion.Euler(transformSubmodule.currentEulerAngles) * Vector3.up;
|
||||
float size = transformSubmodule.currentScale.x;
|
||||
Color color = colorSubmodule.currentBaseColor;
|
||||
|
||||
transform.position = position;
|
||||
transform.rotation = Quaternion.LookRotation(normal);
|
||||
transform.localScale = Vector3.one * size;
|
||||
|
||||
node = new SplinePoint(position, Vector3.up, normal, size, color);
|
||||
track.trackPathSubmodule.SetPathNode(this);
|
||||
@@ -68,8 +70,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM, index,
|
||||
node.position, node.normal, node.size, node.color);
|
||||
matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,38 +78,26 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public class PathNode_BM : BaseElement_BM
|
||||
{
|
||||
public int index;
|
||||
public Vector3 position;
|
||||
public Vector3 normal;
|
||||
public float size;
|
||||
public Color color;
|
||||
|
||||
public PathNode_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PathNode_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement,
|
||||
int index, Vector3 position, Vector3 normal, float size, Color color)
|
||||
public PathNode_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.index = index;
|
||||
this.position = position;
|
||||
this.normal = normal;
|
||||
this.size = size;
|
||||
this.color = color;
|
||||
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = PathNode.GenerateElement(elementName, elementGuid, tags,
|
||||
GetElement(attachedElementGuid) as Track, position, normal, size, color);
|
||||
GetElement(attachedElementGuid) as Track);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return PathNode.GenerateElement(elementName, elementGuid, tags, parent as Track,
|
||||
position, normal, size, color);
|
||||
return PathNode.GenerateElement(elementName, elementGuid, tags, parent as Track);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user