83 lines
3.3 KiB
C#
83 lines
3.3 KiB
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using Lean.Pool;
|
||
using UnityEngine;
|
||
|
||
namespace Ichni.RhythmGame
|
||
{
|
||
public abstract class SubstantialObject : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule, IHaveColorSubmodule
|
||
{
|
||
public string themeBundleName, objectName;
|
||
|
||
public TransformSubmodule transformSubmodule { get; set; }
|
||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||
public ColorSubmodule colorSubmodule { get; set; }
|
||
public bool haveEmission { get; }
|
||
|
||
public static SubstantialObject GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
|
||
string themeBundleName, string objectName, GameElement parentElement)
|
||
{
|
||
GameObject themeBundleObject = ThemeBundleManager.instance.GetObject<GameObject>(themeBundleName, objectName);
|
||
SubstantialObject substantialObject = Instantiate(themeBundleObject, parentElement.transform).GetComponent<SubstantialObject>();
|
||
substantialObject.Initialize(elementName, id, tags, isFirstGenerated, parentElement);
|
||
substantialObject.themeBundleName = themeBundleName;
|
||
substantialObject.objectName = objectName;
|
||
substantialObject.FirstSetUpObject(isFirstGenerated);
|
||
return substantialObject;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 初次生成继承自SubstantialObject的对象时,生成方法必然使用SubstantialObject中的GenerateElement方法。
|
||
/// 因此对于需要进行特殊处理的子类,需要重写FirstSetUpObject方法。
|
||
/// 在读取Beatmap时,生成物体则使用子类本身的GenerateElement方法。
|
||
/// </summary>
|
||
public virtual void FirstSetUpObject(bool isFirstGenerated)
|
||
{
|
||
|
||
}
|
||
|
||
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);
|
||
}
|
||
}
|
||
|
||
namespace Beatmap
|
||
{
|
||
public class SubstantialObject_BM : GameElement_BM
|
||
{
|
||
public string themeBundleName;
|
||
public string objectName;
|
||
|
||
public SubstantialObject_BM()
|
||
{
|
||
|
||
}
|
||
|
||
public SubstantialObject_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||
string themeBundleName, string objectName)
|
||
: base(elementName, elementGuid, tags, attachedElement)
|
||
{
|
||
this.themeBundleName = themeBundleName;
|
||
this.objectName = objectName;
|
||
}
|
||
|
||
public override void ExecuteBM()
|
||
{
|
||
throw new NotImplementedException();
|
||
}
|
||
|
||
public override GameElement DuplicateBM(GameElement attached)
|
||
{
|
||
throw new NotImplementedException();
|
||
}
|
||
}
|
||
}
|
||
} |