特效范例

This commit is contained in:
SoulliesOfficial
2025-02-19 09:15:51 -05:00
parent b36f0469d0
commit 5349cde381
26 changed files with 531 additions and 216 deletions

View File

@@ -4,6 +4,7 @@ using Ichni.Editor;
using Ichni.RhythmGame.Beatmap;
using Sirenix.Utilities;
using UnityEngine;
using UnityEngine.Events;
namespace Ichni.RhythmGame
{
@@ -83,6 +84,12 @@ namespace Ichni.RhythmGame
public interface IHaveEffectSubmodule
{
public EffectSubmodule effectSubmodule { get; set; }
public static Dictionary<string, EffectBase> EffectCollection { get; } =
new Dictionary<string, EffectBase>()
{
{"BloomShake", new BloomShake(1, 2)}
};
}
namespace Beatmap

View File

@@ -17,6 +17,7 @@ namespace Ichni.RhythmGame
isOverridingDuration = false;
startTime = -32767;//TODO: 换为-delay
endTime = 32767;//TODO: 换为songLength
}
public TimeDurationSubmodule(GameElement attachedGameElement, bool isOverridingDuration, float startTime, float endTime) : base(attachedGameElement)

View File

@@ -29,8 +29,7 @@ namespace Ichni.RhythmGame
public bool scaleDirtyMark;
public bool eulerAnglesOffsetLock;
public TransformSubmodule(GameElement attachedGameElement) : base(attachedGameElement)
{
this.originalPosition = Vector3.zero;
@@ -51,7 +50,8 @@ namespace Ichni.RhythmGame
eulerAnglesOffsetLock = false;
// (attachedGameElement as IHaveTransformSubmodule).SetTransformObserver();
(attachedGameElement as IHaveTransformSubmodule).transformSubmodule = this;
(attachedGameElement as IHaveTransformSubmodule).SetTransformObserver();
}
public TransformSubmodule(GameElement attachedGameElement,
@@ -75,7 +75,8 @@ namespace Ichni.RhythmGame
eulerAnglesOffsetLock = false;
// (attachedGameElement as IHaveTransformSubmodule).SetTransformObserver();
(attachedGameElement as IHaveTransformSubmodule).transformSubmodule = this;
(attachedGameElement as IHaveTransformSubmodule).SetTransformObserver();
}
public override void SaveBM()
@@ -98,6 +99,10 @@ namespace Ichni.RhythmGame
inspector.GenerateParameterText(this, container, "Current Rotation", nameof(currentEulerAngles), true);
var currentScaleText =
inspector.GenerateParameterText(this, container, "Current Scale", nameof(currentScale), true);
originalPosInputField.AddListenerFunction(Refresh);
originalRotInputField.AddListenerFunction(Refresh);
originalScaleInputField.AddListenerFunction(Refresh);
}
public override void Refresh()
@@ -119,7 +124,7 @@ namespace Ichni.RhythmGame
public void SetTransformObserver()
{
GameElement attachedGameElement = transformSubmodule.attachedGameElement;
Observable.EveryUpdate().Subscribe(_ =>
{
if (transformSubmodule == null)
@@ -197,6 +202,7 @@ namespace Ichni.RhythmGame
public override void ExecuteBM()
{
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
Debug.Log(attachedElementGuid);
(attachedElement as IHaveTransformSubmodule).transformSubmodule = new TransformSubmodule(attachedElement, originalPosition, originalEulerAngles, originalScale);
attachedElement.submoduleList.Add((attachedElement as IHaveTransformSubmodule).transformSubmodule);
}