音乐效果
This commit is contained in:
@@ -15,9 +15,9 @@ namespace Ichni.Editor
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// playButton.onClick.AddListener(EditorManager.instance.musicPlayer.PlayMusic);
|
||||
// pauseButton.onClick.AddListener(EditorManager.instance.musicPlayer.PauseMusic);
|
||||
// stopButton.onClick.AddListener(EditorManager.instance.musicPlayer.StopMusic);
|
||||
playButton.onClick.AddListener(EditorManager.instance.musicPlayer.PlayMusic);
|
||||
pauseButton.onClick.AddListener(EditorManager.instance.musicPlayer.PauseMusic);
|
||||
stopButton.onClick.AddListener(EditorManager.instance.musicPlayer.StopMusic);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,12 +125,14 @@ namespace Ichni.RhythmGame
|
||||
private static Dictionary<string, EffectBase> EffectCollection { get; } =
|
||||
new Dictionary<string, EffectBase>()
|
||||
{
|
||||
{ "Bloom", new BloomEffect(1, 2, CustomCurvePresets.Parabolic(1,0,2)) },
|
||||
{ "Bloom", new BloomEffect(1, 2, CustomCurvePresets.Parabolic(1, 0, 1)) },
|
||||
{ "CameraShake", new CameraShakeEffect(1, 50, 1, 1, 1) },
|
||||
{ "ChromaticAberration", new ChromaticAberrationEffect(1, 1, CustomCurvePresets.Parabolic(1,0,1)) },
|
||||
{ "Vignette", new VignetteEffect(1, 1, 0.4f, Color.black, CustomCurvePresets.Parabolic(1,0,1)) },
|
||||
{ "ChromaticAberration", new ChromaticAberrationEffect(1, 1, CustomCurvePresets.Parabolic(1, 0, 1)) },
|
||||
{ "Vignette", new VignetteEffect(1, 1, 0.4f, Color.black, CustomCurvePresets.Parabolic(1, 0, 1)) },
|
||||
{ "SetInteger", new SetIntegerEffect("New Variable", 0, false, 0, 1) },
|
||||
{ "EnableControl", new EnableControlEffect(null, "New Variable", 0, false, "") },
|
||||
{ "LowPassFilter", new LowPassFilterEffect(1, 10, CustomCurvePresets.Parabolic(1, 0, 1)) },
|
||||
{ "HighPassFilter", new HighPassFilterEffect(1, 22000, CustomCurvePresets.Parabolic(1, 0, 1)) }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
18
Assets/Scripts/Manager/AudioManager.cs
Normal file
18
Assets/Scripts/Manager/AudioManager.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
namespace Ichni
|
||||
{
|
||||
public class AudioManager : MonoBehaviour
|
||||
{
|
||||
public AudioMixer audioMixer;
|
||||
public AudioMixerGroup masterGroup, musicGroup, noteSoundFXGroup, uiSoundFXGroup;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Manager/AudioManager.cs.meta
Normal file
11
Assets/Scripts/Manager/AudioManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ce536c50a1fc2c4c9a143590a1695b7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -35,6 +35,8 @@ public class BasePrefabsCollection : SerializedScriptableObject
|
||||
public GameObject cameraShakeEffect;
|
||||
public GameObject chromaticAberrationEffect;
|
||||
public GameObject vignetteEffect;
|
||||
public GameObject lowPassFilterEffect;
|
||||
public GameObject highPassFilterEffect;
|
||||
|
||||
[Title("Inspector相关")]
|
||||
public GameObject inspectorSecondaryWindow;
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Ichni
|
||||
public bool isLoaded;
|
||||
|
||||
public ProjectManager projectManager;
|
||||
public AudioManager audioManager;
|
||||
public MusicPlayer musicPlayer;
|
||||
public EditorUIManager uiManager;
|
||||
public EditorSettings editorSettings;
|
||||
|
||||
Reference in New Issue
Block a user