架构重新设计
基本重做了所有物体和次级模块代码
This commit is contained in:
@@ -3,45 +3,58 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
using Ichni;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class PathNode : BaseElement
|
||||
public partial class PathNode : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule,
|
||||
IHaveColorSubmodule
|
||||
{
|
||||
public ColorSubmodule colorSubmodule;
|
||||
|
||||
public Track track;
|
||||
|
||||
public int index => track.trackPathSubmodule.pathNodeList.IndexOf(this);
|
||||
|
||||
public SplinePoint node;
|
||||
|
||||
public static PathNode GenerateElement(string elementName, Guid id, List<string> tags, Track track)
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
|
||||
public static PathNode GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
|
||||
Track track)
|
||||
{
|
||||
PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform)
|
||||
.GetComponent<PathNode>();
|
||||
|
||||
pathNode.Initialize(elementName, id, tags);
|
||||
pathNode.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
|
||||
pathNode.track = track;
|
||||
//pathNode.index = index;
|
||||
|
||||
pathNode.transformSubmodule = new TransformSubmodule(pathNode);
|
||||
pathNode.timeDurationSubmodule = new TimeDurationSubmodule(pathNode);
|
||||
pathNode.colorSubmodule = new ColorSubmodule(pathNode);
|
||||
|
||||
track.trackPathSubmodule.pathNodeList.Add(pathNode);
|
||||
|
||||
pathNode.SetParent(track);
|
||||
|
||||
return pathNode;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
colorSubmodule = new ColorSubmodule(this);
|
||||
|
||||
submoduleList.Add(transformSubmodule);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
submoduleList.Add(colorSubmodule);
|
||||
}
|
||||
|
||||
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
|
||||
|
||||
Refresh();
|
||||
if (track.trackPathSubmodule.pathNodeList.Count > 3)
|
||||
{
|
||||
@@ -58,7 +71,7 @@ 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;
|
||||
@@ -72,34 +85,34 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM);
|
||||
matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class PathNode_BM : BaseElement_BM
|
||||
public class PathNode_BM : GameElement_BM
|
||||
{
|
||||
public PathNode_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PathNode_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement)
|
||||
public PathNode_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = PathNode.GenerateElement(elementName, elementGuid, tags,
|
||||
matchedElement = PathNode.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as Track);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return PathNode.GenerateElement(elementName, elementGuid, tags, parent as Track);
|
||||
return PathNode.GenerateElement(elementName, elementGuid, tags, false, parent as Track);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user