架构重新设计
基本重做了所有物体和次级模块代码
This commit is contained in:
@@ -1,43 +1,40 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class Track : BaseElement
|
||||
public partial class Track : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule
|
||||
{
|
||||
public TrackPathSubmodule trackPathSubmodule;
|
||||
public TrackTimeSubmodule trackTimeSubmodule;
|
||||
public TrackRendererSubmodule trackRendererSubmodule;
|
||||
|
||||
public static Track GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
BaseElement parent, Vector3 position)
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public TrackPathSubmodule trackPathSubmodule { get; set; }
|
||||
public TrackTimeSubmodule trackTimeSubmodule { get; set; }
|
||||
public TrackRendererSubmodule trackRendererSubmodule { get; set; }
|
||||
|
||||
public static Track GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated, GameElement parent)
|
||||
{
|
||||
Track track = Instantiate(EditorManager.instance.basePrefabs.track, parent.transform).GetComponent<Track>();
|
||||
|
||||
track.Initialize(elementName, id, tags);
|
||||
track.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
track.SetParent(parent);
|
||||
|
||||
track.transformSubmodule = new TransformSubmodule(track, position, Vector3.zero, Vector3.one);
|
||||
track.timeDurationSubmodule = new TimeDurationSubmodule(track);
|
||||
|
||||
track.trackPathSubmodule = null;
|
||||
track.trackTimeSubmodule = null;
|
||||
track.trackRendererSubmodule = null;
|
||||
|
||||
track.SetTransformObserver();
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
public override void AfterInitialize()
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
submoduleList.Add(trackPathSubmodule);
|
||||
submoduleList.Add(trackTimeSubmodule);
|
||||
submoduleList.Add(trackRendererSubmodule);
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
trackPathSubmodule = null;
|
||||
trackTimeSubmodule = null;
|
||||
trackRendererSubmodule = null;
|
||||
|
||||
submoduleList.Add(transformSubmodule);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -53,7 +50,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Track_BM(elementName, elementGuid, tags, parentElement.matchedBM);
|
||||
matchedBM = new Beatmap.Track_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,14 +72,14 @@ namespace Ichni.RhythmGame
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Track_BM : BaseElement_BM
|
||||
public class Track_BM : GameElement_BM
|
||||
{
|
||||
public Track_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Track_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement)
|
||||
public Track_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
|
||||
@@ -90,12 +87,12 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Track.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), Vector3.zero);
|
||||
matchedElement = Track.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid));
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return Track.GenerateElement(elementName, elementGuid, tags, parent, Vector3.zero);
|
||||
return Track.GenerateElement(elementName, elementGuid, tags, false, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user