基础内容-8

添加BM存档类
This commit is contained in:
SoulliesOfficial
2025-02-02 21:59:43 -05:00
parent efca87e9cd
commit bc1c5d65ef
20 changed files with 926 additions and 90 deletions

View File

@@ -10,7 +10,7 @@ namespace Ichni.RhythmGame
/// <summary>
/// 将物体的z轴指向目标物体注意LookAt的启用期间物体的旋转将被锁定
/// </summary>
public class LookAt : AnimationBase
public partial class LookAt : AnimationBase
{
public TransformSubmodule targetTransformSubmodule;
public BaseElement lookAtObject;
@@ -23,7 +23,7 @@ namespace Ichni.RhythmGame
LookAt look = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent<LookAt>();
look.Initialize(elementName, id, tags);
look.targetObject = targetObject;
look.lookAtObject = lookAtTarget;
look.enabling = enabling;
@@ -37,7 +37,7 @@ namespace Ichni.RhythmGame
{
throw new System.Exception("Target object does not have a TransformSubmodule");
}
look.SetParent(targetObject);
look.timeDurationSubmodule.SetDuration(-999f, 999f); //TODO: 换为(-delay, songLength)
@@ -71,5 +71,44 @@ namespace Ichni.RhythmGame
targetTransformSubmodule.eulerAnglesOffsetLock = false;
}
}
public override void SaveBM()
{
matchedBM = new Beatmap.LookAt_BM(elementName, elementGuid, tags, parentElement.matchedBM,
enabling.ConvertToBM(), lookAtObject.elementGuid);
}
}
namespace Beatmap
{
public class LookAt_BM : BaseElement_BM
{
public FlexibleBool_BM enabling;
public Guid lookAtObjectGuid;
public LookAt_BM()
{
}
public LookAt_BM(string elementName, Guid elementGuid, List<string> tags,
BaseElement_BM attachedElement, FlexibleBool_BM enabling, Guid lookAtObjectGuid) : base(elementName,
elementGuid, tags, attachedElement)
{
this.enabling = enabling;
this.lookAtObjectGuid = lookAtObjectGuid;
}
public override void ExecuteBM()
{
matchedElement = LookAt.GenerateElement(elementName, elementGuid, tags,
GetElement(attachedElementGuid), GetElement(lookAtObjectGuid), enabling.ConvertToGameType());
}
public override BaseElement DuplicateBM(BaseElement parent)
{
return LookAt.GenerateElement(elementName, elementGuid, tags, parent,
GetElement(lookAtObjectGuid), enabling.ConvertToGameType());
}
}
}
}