架构重新设计

基本重做了所有物体和次级模块代码
This commit is contained in:
SoulliesOfficial
2025-02-08 02:31:39 -05:00
parent 752c9b73e3
commit 7ab738cb68
44 changed files with 1320 additions and 847 deletions

View File

@@ -1,74 +1,83 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame
{
public partial class Trail : BaseElement
public partial class Trail : GameElement, IHaveTransformSubmodule
{
public TrailRenderer trailRenderer;
public Material renderMaterial;
public float visibleTimeLength;
public static Trail GenerateElement(string name, Guid id, List<string> tags,
BaseElement parentElement, float visibleTimeLength, Material material = null)
public TransformSubmodule transformSubmodule { get; set; }
public static Trail GenerateElement(string name, Guid id, List<string> tags, bool isFirstGenerated,
GameElement parentElement, float visibleTimeLength, Material material = null)
{
Trail trail = Instantiate(EditorManager.instance.basePrefabs.trail).GetComponent<Trail>();
trail.trailRenderer = trail.GetComponent<TrailRenderer>();
trail.Initialize(name, id, tags);
trail.Initialize(name, id, tags, isFirstGenerated);
trail.renderMaterial =
material == null ? EditorManager.instance.basePrefabs.defaultTrailMaterial : material;
trail.trailRenderer.material = trail.renderMaterial;
trail.visibleTimeLength = visibleTimeLength;
trail.SetParent(parentElement);
trail.transformSubmodule = new TransformSubmodule(trail);
return trail;
}
protected override void SetDefaultSubmodules()
{
transformSubmodule = new TransformSubmodule(this);
submoduleList.Add(transformSubmodule);
}
}
public partial class Trail
{
public override void SaveBM()
{
matchedBM = new Beatmap.Trail_BM(elementName, elementGuid, tags, parentElement.matchedBM, visibleTimeLength,
renderMaterial);
matchedBM = new Trail_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
visibleTimeLength, renderMaterial);
}
}
namespace Beatmap
{
public class Trail_BM : BaseElement_BM
public class Trail_BM : GameElement_BM
{
public float visibleTimeLength;
public Material renderMaterial;
public string renderMaterialName;
public Trail_BM()
{
}
public Trail_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement,
float visibleTimeLength, Material renderMaterial)
: base(elementName, elementGuid, tags, attachedElement)
public Trail_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
float visibleTimeLength, Material renderMaterial) : base(elementName, elementGuid, tags,
attachedElement)
{
this.visibleTimeLength = visibleTimeLength;
this.renderMaterial = renderMaterial;
this.renderMaterialName = renderMaterial.name;
}
public override void ExecuteBM()
{
matchedElement = Trail.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
visibleTimeLength, renderMaterial);
matchedElement = Trail.GenerateElement(elementName, elementGuid, tags,
false, GetElement(attachedElementGuid),
visibleTimeLength); //TODO: Implement Material
}
public override BaseElement DuplicateBM(BaseElement parent)
public override GameElement DuplicateBM(GameElement parent)
{
return Trail.GenerateElement(elementName, elementGuid, tags, parent, visibleTimeLength, renderMaterial);
return Trail.GenerateElement(elementName, elementGuid, tags,
false, parent, visibleTimeLength); //TODO: Implement Material
}
}
}