音乐效果
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9637d66204ac39b4d8107a555acf18df
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,84 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.FeedbacksForThirdParty;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class HighPassFilterEffect : EffectBase
|
||||
{
|
||||
public float duration;
|
||||
public float peak;
|
||||
public AnimationCurve intensityCurve;
|
||||
|
||||
public HighPassFilterEffect(float duration, float peak, AnimationCurve intensityCurve)
|
||||
{
|
||||
this.effectTime = 0;
|
||||
this.duration = duration;
|
||||
this.peak = peak;
|
||||
this.intensityCurve = intensityCurve;
|
||||
}
|
||||
|
||||
public override void Adjust()
|
||||
{
|
||||
MMF_Player effect = LeanPool.Spawn(EditorManager.instance.basePrefabs.highPassFilterEffect).GetComponent<MMF_Player>();
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterHighPass>().Duration = duration;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterHighPass>().RemapHighPassZero = 10;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterHighPass>().RemapHighPassOne = peak;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterHighPass>().ShakeHighPass = intensityCurve;
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, duration);
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new HighPassFilterEffect_BM(duration, peak, intensityCurve);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("High Pass Filter");
|
||||
var effectSettings = container.GenerateSubcontainer(3);
|
||||
var effectTimeField = inspector.GenerateInputField(this, effectSettings, "Duration", nameof(duration));
|
||||
var bloomPeakField = inspector.GenerateInputField(this, effectSettings, "Bottom", nameof(peak));
|
||||
var intensityCurveButton = inspector.GenerateButton(this, effectSettings, "Intensity Curve", () =>
|
||||
{
|
||||
var intensityCurveWindow =
|
||||
inspector.GenerateCompositeParameterWindow(this, "Intensity Curve", nameof(intensityCurve)).SetAsCustomCurve();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class HighPassFilterEffect_BM: EffectBase_BM
|
||||
{
|
||||
public float duration;
|
||||
public float peak;
|
||||
public AnimationCurve intensityCurve;
|
||||
|
||||
public HighPassFilterEffect_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public HighPassFilterEffect_BM(float duration, float peak, AnimationCurve intensityCurve)
|
||||
{
|
||||
this.effectTime = 0;
|
||||
this.duration = duration;
|
||||
this.peak = peak;
|
||||
this.intensityCurve = intensityCurve;
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
|
||||
{
|
||||
return new HighPassFilterEffect(duration, peak, intensityCurve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b44293b2a64861a4e951d014eed6ea41
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,84 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.FeedbacksForThirdParty;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class LowPassFilterEffect : EffectBase
|
||||
{
|
||||
public float duration;
|
||||
public float bottom;
|
||||
public AnimationCurve intensityCurve;
|
||||
|
||||
public LowPassFilterEffect(float duration, float bottom, AnimationCurve intensityCurve)
|
||||
{
|
||||
this.effectTime = 0;
|
||||
this.duration = duration;
|
||||
this.bottom = bottom;
|
||||
this.intensityCurve = intensityCurve;
|
||||
}
|
||||
|
||||
public override void Adjust()
|
||||
{
|
||||
MMF_Player effect = LeanPool.Spawn(EditorManager.instance.basePrefabs.lowPassFilterEffect).GetComponent<MMF_Player>();
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterLowPass>().Duration = duration;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterLowPass>().RemapLowPassZero = 22000;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterLowPass>().RemapLowPassOne = bottom;
|
||||
effect.GetFeedbackOfType<MMF_AudioFilterLowPass>().ShakeLowPass = intensityCurve;
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, duration);
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new LowPassFilterEffect_BM(duration, bottom, intensityCurve);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Low Pass Filter");
|
||||
var effectSettings = container.GenerateSubcontainer(3);
|
||||
var effectTimeField = inspector.GenerateInputField(this, effectSettings, "Duration", nameof(duration));
|
||||
var bloomPeakField = inspector.GenerateInputField(this, effectSettings, "Bottom", nameof(bottom));
|
||||
var intensityCurveButton = inspector.GenerateButton(this, effectSettings, "Intensity Curve", () =>
|
||||
{
|
||||
var intensityCurveWindow =
|
||||
inspector.GenerateCompositeParameterWindow(this, "Intensity Curve", nameof(intensityCurve)).SetAsCustomCurve();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class LowPassFilterEffect_BM: EffectBase_BM
|
||||
{
|
||||
public float duration;
|
||||
public float bottom;
|
||||
public AnimationCurve intensityCurve;
|
||||
|
||||
public LowPassFilterEffect_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LowPassFilterEffect_BM(float duration, float bottom, AnimationCurve intensityCurve)
|
||||
{
|
||||
this.effectTime = 0;
|
||||
this.duration = duration;
|
||||
this.bottom = bottom;
|
||||
this.intensityCurve = intensityCurve;
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
|
||||
{
|
||||
return new LowPassFilterEffect(duration, bottom, intensityCurve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43baab47a435f9445a9fff499c9a7480
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -21,6 +21,7 @@ namespace Ichni.RhythmGame
|
||||
// 新建一个临时的 GameObject
|
||||
GameObject go = new GameObject("TempAudio2D");
|
||||
var src = go.AddComponent<AudioSource>();
|
||||
src.outputAudioMixerGroup = EditorManager.instance.audioManager.noteSoundFXGroup;
|
||||
src.clip = clip;
|
||||
src.volume = volume;
|
||||
src.spatialBlend = 0f; // 0 = 完全 2D
|
||||
|
||||
Reference in New Issue
Block a user