修HeadPoint
This commit is contained in:
@@ -152,7 +152,7 @@ namespace Ichni.RhythmGame
|
||||
var trackPercentPointButton = inspector.GenerateButton(this, trackMajorPointSubcontainer, "Track Percent Point",
|
||||
() => { TrackPercentPoint.GenerateElement("New Track Percent Point", Guid.NewGuid(), new List<string>(), true, this, new FlexibleFloat()); }); //百分比点
|
||||
var trackHeadPointButton = inspector.GenerateButton(this, trackMajorPointSubcontainer, "Track Head Point",
|
||||
() => { TrackHeadPoint.GenerateElement("New Track Head Point", Guid.NewGuid(), new List<string>(), true, this, false); }); //头部点(必须先有TrackTimeSubmoduleMovable)
|
||||
() => { TrackHeadPoint.GenerateElement("New Track Head Point", Guid.NewGuid(), new List<string>(), true, this, false, Vector3.zero); }); //头部点(必须先有TrackTimeSubmoduleMovable)
|
||||
if (trackTimeSubmodule is not TrackTimeSubmoduleMovable) trackHeadPointButton.button.interactable = false;
|
||||
|
||||
var noteSubcontainer = generateContainer.GenerateSubcontainer(3);
|
||||
|
||||
@@ -18,14 +18,13 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public bool motionApplyRotation;
|
||||
|
||||
public Vector3 motionEulerAngles;
|
||||
private float SongTime => EditorManager.instance.songInformation.songTime;
|
||||
|
||||
public static TrackHeadPoint GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, Track track, bool motionApplyRotation)
|
||||
bool isFirstGenerated, Track track, bool motionApplyRotation, Vector3 motionEulerAngles)
|
||||
{
|
||||
TrackHeadPoint head = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform)
|
||||
.AddComponent<TrackHeadPoint>();
|
||||
TrackHeadPoint head = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform).AddComponent<TrackHeadPoint>();
|
||||
|
||||
head.Initialize(elementName, id, tags, isFirstGenerated, track);
|
||||
head.track = track;
|
||||
@@ -35,6 +34,8 @@ namespace Ichni.RhythmGame
|
||||
|
||||
head.motionApplyRotation = motionApplyRotation;
|
||||
head.trackPositioner.motion.applyRotation = motionApplyRotation;
|
||||
head.motionEulerAngles = motionEulerAngles;
|
||||
head.trackPositioner.motion.rotationOffset = motionEulerAngles;
|
||||
|
||||
return head;
|
||||
}
|
||||
@@ -58,7 +59,8 @@ namespace Ichni.RhythmGame
|
||||
public override void SaveBM()
|
||||
{
|
||||
// 保存MotionAngles到BM
|
||||
matchedBM = new TrackHeadPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM, motionApplyRotation);
|
||||
matchedBM = new TrackHeadPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
motionApplyRotation, motionEulerAngles);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
@@ -67,8 +69,12 @@ namespace Ichni.RhythmGame
|
||||
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Track Percent Point");
|
||||
var MotionAngles = container.GenerateSubcontainer(3);
|
||||
var MotionAnglesT = inspector.GenerateToggle(this, MotionAngles, "Motion With Angles", nameof(motionApplyRotation));
|
||||
var motionAngles0 = container.GenerateSubcontainer(3);
|
||||
var motionAnglesApplyToggle = inspector.GenerateToggle(this, motionAngles0, "Motion With Angles", nameof(motionApplyRotation))
|
||||
.AddListenerFunction(() => trackPositioner.motion.applyRotation = motionApplyRotation);
|
||||
var motionAngles1 = container.GenerateSubcontainer(1);
|
||||
var motionAnglesValueInputField = inspector.GenerateVector3InputField(this, motionAngles1, "Motion Angles", nameof(motionEulerAngles))
|
||||
.AddListenerFunction(()=> trackPositioner.motion.rotationOffset = motionEulerAngles);
|
||||
|
||||
var generation = container.GenerateSubcontainer(3);
|
||||
var generateTrailButton = inspector.GenerateButton(this, generation, "Generate Trail", () =>
|
||||
@@ -81,12 +87,6 @@ namespace Ichni.RhythmGame
|
||||
() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
|
||||
true, this));
|
||||
}
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
trackPositioner.motion.applyRotation = motionApplyRotation;
|
||||
this.transform.eulerAngles = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
@@ -95,6 +95,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
// 新增属性
|
||||
public bool motionApplyRotation = false;
|
||||
public Vector3 motionEulerAngles = Vector3.zero;
|
||||
|
||||
public TrackHeadPoint_BM()
|
||||
{
|
||||
@@ -102,24 +103,23 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public TrackHeadPoint_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
GameElement_BM attachedElement, bool motionApplyRotation)
|
||||
GameElement_BM attachedElement, bool motionApplyRotation, Vector3 motionEulerAngles)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.motionApplyRotation = motionApplyRotation;
|
||||
this.motionEulerAngles = motionEulerAngles;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
var element = TrackHeadPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as Track, motionApplyRotation);
|
||||
matchedElement = element;
|
||||
matchedElement = TrackHeadPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as Track, motionApplyRotation, motionEulerAngles);
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
var newElement = TrackHeadPoint.GenerateElement(elementName, Guid.NewGuid(), tags,
|
||||
false, parent as Track, motionApplyRotation);
|
||||
return newElement;
|
||||
return TrackHeadPoint.GenerateElement(elementName, Guid.NewGuid(), tags,
|
||||
false, parent as Track, motionApplyRotation, motionEulerAngles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user