特效自定义曲线

This commit is contained in:
SoulliesOfficial
2025-03-14 22:14:25 -04:00
parent ac2259e813
commit 400bb39058
8 changed files with 266 additions and 39 deletions

View File

@@ -53,4 +53,13 @@ MonoBehaviour:
- {fileID: 7768496905287876572, guid: f4b4e87edddc74e4e8d6b9d4cc0e31fc, type: 3}
- {fileID: 2890788359140629188, guid: f4b4e87edddc74e4e8d6b9d4cc0e31fc, type: 3}
- {fileID: 5502985463212138770, guid: f4b4e87edddc74e4e8d6b9d4cc0e31fc, type: 3}
_Values: febc7fe765b0407bac90167906740a2a8c8e90345544ac394753b1a281922a4e7e358b9883b18c46114589015196ee4776dac15926adab1e4620c9a232d1ed566ec628c1efb3c0693a954d39e3d36066f7d0f7b20b638d2be0a95163e7ea141dcc1f6b7591d3a73ee5a8df6ea08ec51a799b52d05b53bb1a949134651819880de72e3b2ecf0dbc66f70629b01243766dcd4f9bcf7dee1e4185b3b64b611e3b6ddb9f15d3e773b400f9c3036d9fa280501bc798c97db9902b9e9549f346d5832eb56db8a23f89a7640733ce3e6d52283bf75ba0ec3738db26a8b1d7bde9c42f2998b1c6e5674f4d76eecb0c63a687616ba5f85375dbfd6b7da1d121924bab6f35b201cfe2da41f91439554f449eca2a0e0ae957f27d5ee2668ac131e2db057329631d4d0b8c6d0e3ae43753f6ee4b353bd2e2253bebcd1860
- {fileID: 4800000, guid: da07703fcc09f8d4799221050659bd55, type: 3}
- {fileID: -6465566751694194690, guid: ee7160752d2114149904ca2b2b012bbf, type: 3}
- {fileID: 7671065637303904002, guid: df4a22c0fc7634babaac85c473d4b9fc, type: 3}
- {fileID: 2800000, guid: f87b5805002ec9649bcb1b96d8a16ba9, type: 3}
- {fileID: 5502985463212138770, guid: df4a22c0fc7634babaac85c473d4b9fc, type: 3}
- {fileID: 2890788359140629188, guid: df4a22c0fc7634babaac85c473d4b9fc, type: 3}
- {fileID: 7768496905287876572, guid: df4a22c0fc7634babaac85c473d4b9fc, type: 3}
- {fileID: 21300000, guid: c7353b93c0ea87c46af8eba38a20a636, type: 3}
- {fileID: 2800000, guid: c7353b93c0ea87c46af8eba38a20a636, type: 3}
_Values: febc7fe765b0407bac90167906740a2a8c8e90345544ac394753b1a281922a4e7e358b9883b18c46114589015196ee4776dac15926adab1e4620c9a232d1ed566ec628c1efb3c0693a954d39e3d36066f7d0f7b20b638d2be0a95163e7ea141dcc1f6b7591d3a73ee5a8df6ea08ec51a799b52d05b53bb1a949134651819880de72e3b2ecf0dbc66f70629b01243766dcd4f9bcf7dee1e4185b3b64b611e3b6ddb9f15d3e773b400f9c3036d9fa280501bc798c97db9902b9e9549f346d5832eb56db8a23f89a7640733ce3e6d52283bf75ba0ec3738db26a8b1d7bde9c42f2998b1c6e5674f4d76eecb0c63a687616ba5f85375dbfd6b7da1d121924bab6f35b201cfe2da41f91439554f449eca2a0e0ae957f27d5ee2668ac131e2db057329631d4d0b8c6d0e3ae43753f6ee4b353bd2e2253bebcd1860a0d4110fb94b096df33eaacce4a3cf68897f3d09494eb639d80a18a0e72b703319371d8cc711425cd33b203e27204208f885cc092656e150e128c851cd967a1faedeb3ac8643a066

View File

@@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Ichni
{
/// <summary>
/// 自定义曲线预设
/// </summary>
public static class CustomCurvePresets
{
/// <summary>
/// 抛物线曲线,在中间达到最大值,两端为起始值
/// </summary>
/// <param name="totalTime">总时间</param>
/// <param name="startValue">起始(和结束)值</param>
/// <param name="peakValue">中点最大值</param>
public static AnimationCurve Parabolic(float totalTime, float startValue, float peakValue)
{
Keyframe[] keys = new Keyframe[3];
keys[0] = new Keyframe(0, startValue, 0, 0);
keys[1] = new Keyframe(totalTime / 2, peakValue, 0, 0);
keys[2] = new Keyframe(totalTime, startValue, 0, 0);
return new AnimationCurve(keys);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ac4cc158ed88d48af9a350196b874508
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -104,10 +104,10 @@ namespace Ichni.RhythmGame
private static Dictionary<string, EffectBase> EffectCollection { get; } =
new Dictionary<string, EffectBase>()
{
{ "Bloom", new BloomEffect(1, 2) },
{ "Bloom", new BloomEffect(1, 2, CustomCurvePresets.Parabolic(1,0,2)) },
{ "CameraShake", new CameraShakeEffect(1, 50, 1, 1, 1) },
{ "ChromaticAberration", new ChromaticAberrationEffect(1, 1) },
{ "Vignette", new VignetteEffect(1, 1, 0.4f, Color.black) }
{ "ChromaticAberration", new ChromaticAberrationEffect(1, 1, CustomCurvePresets.Parabolic(1,0,1)) },
{ "Vignette", new VignetteEffect(1, 1, 0.4f, Color.black, CustomCurvePresets.Parabolic(1,0,1)) }
};
}

View File

@@ -7,6 +7,7 @@ using Lean.Pool;
using MoreMountains.Feedbacks;
using MoreMountains.FeedbacksForThirdParty;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Ichni.RhythmGame
{
@@ -14,26 +15,29 @@ namespace Ichni.RhythmGame
{
public float duration;
public float peak;
public BloomEffect(float duration, float peak)
public AnimationCurve intensityCurve;
public BloomEffect(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.bloomEffect).GetComponent<MMF_Player>();
effect.GetFeedbackOfType<MMF_Bloom_URP>().ShakeDuration = duration;
effect.GetFeedbackOfType<MMF_Bloom_URP>().RemapIntensityOne = peak;
effect.GetFeedbackOfType<MMF_Bloom_URP>().ShakeIntensity = intensityCurve;
effect.PlayFeedbacks();
LeanPool.Despawn(effect.gameObject, duration);
}
public override EffectBase_BM ConvertToBM()
{
return new BloomEffect_BM(duration, peak);
return new BloomEffect_BM(duration, peak, intensityCurve);
}
public override void SetUpInspector()
@@ -42,6 +46,11 @@ namespace Ichni.RhythmGame
var container = inspector.GenerateContainer("Bloom Shake");
var effectTimeField = inspector.GenerateInputField(this, container, "Bloom Time", nameof(duration));
var bloomPeakField = inspector.GenerateInputField(this, container, "Bloom Peak", nameof(peak));
var intensityCurveButton = inspector.GenerateButton(this, container, "Intensity Curve", () =>
{
var intensityCurveWindow = inspector.GenerateCompositeParameterWindow(this, "Intensity Curve", nameof(intensityCurve));
intensityCurveWindow.SetAsCustomCurve();
});
}
}
@@ -51,22 +60,24 @@ namespace Ichni.RhythmGame
{
public float duration;
public float peak;
public AnimationCurve intensityCurve;
public BloomEffect_BM()
{
}
public BloomEffect_BM(float duration, float peak)
public BloomEffect_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 BloomEffect(duration, peak);
return new BloomEffect(duration, peak, intensityCurve);
}
}
}

View File

@@ -13,19 +13,22 @@ namespace Ichni.RhythmGame
{
public float duration;
public float peak;
public AnimationCurve intensityCurve;
public ChromaticAberrationEffect(float duration, float peak)
public ChromaticAberrationEffect(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.chromaticAberrationEffect).GetComponent<MMF_Player>();
effect.GetFeedbackOfType<MMF_ChromaticAberration_URP>().Duration = duration;
effect.GetFeedbackOfType<MMF_ChromaticAberration_URP>().RemapIntensityOne = peak;
effect.GetFeedbackOfType<MMF_ChromaticAberration_URP>().Intensity = intensityCurve;
effect.PlayFeedbacks();
LeanPool.Despawn(effect.gameObject, duration);
}
@@ -41,6 +44,11 @@ namespace Ichni.RhythmGame
var container = inspector.GenerateContainer("Chromatic Aberration");
var effectTimeField = inspector.GenerateInputField(this, container, "Duration", nameof(duration));
var bloomPeakField = inspector.GenerateInputField(this, container, "Peak Value", nameof(peak));
var intensityCurveButton = inspector.GenerateButton(this, container, "Intensity Curve", () =>
{
var intensityCurveWindow = inspector.GenerateCompositeParameterWindow(this, "Intensity Curve", nameof(intensityCurve));
intensityCurveWindow.SetAsCustomCurve();
});
}
}
@@ -50,7 +58,8 @@ namespace Ichni.RhythmGame
{
public float duration;
public float peak;
public AnimationCurve intensityCurve;
public ChromaticAberrationEffect_BM()
{
@@ -65,7 +74,7 @@ namespace Ichni.RhythmGame
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new ChromaticAberrationEffect(duration, peak);
return new ChromaticAberrationEffect(duration, peak, intensityCurve);
}
}
}

View File

@@ -15,21 +15,24 @@ namespace Ichni.RhythmGame
public float peak;
public float smoothness;
public Color color;
public AnimationCurve intensityCurve;
public VignetteEffect(float duration, float peak, float smoothness, Color color)
public VignetteEffect(float duration, float peak, float smoothness, Color color, AnimationCurve intensityCurve)
{
this.effectTime = 0;
this.duration = duration;
this.peak = peak;
this.smoothness = smoothness;
this.color = color;
this.intensityCurve = intensityCurve;
}
public override void Adjust()
{
MMF_Player effect = Lean.Pool.LeanPool.Spawn(EditorManager.instance.basePrefabs.vignetteEffect).GetComponent<MMF_Player>();
effect.GetFeedbackOfType<MMF_Vignette_URP>().Duration = duration;
effect.GetFeedbackOfType<MMF_Vignette_URP>().RemapIntensityOne = peak;
effect.GetFeedbackOfType<MMF_Vignette_URP>().Intensity = intensityCurve;
if (EditorManager.instance.postProcessingManager.globalVolume.profile.TryGet(out Vignette vignette))
{
vignette.smoothness.value = smoothness;
@@ -41,7 +44,7 @@ namespace Ichni.RhythmGame
public override EffectBase_BM ConvertToBM()
{
return new VignetteEffect_BM(duration, peak, smoothness, color);
return new VignetteEffect_BM(duration, peak, smoothness, color, intensityCurve);
}
public override void SetUpInspector()
@@ -52,6 +55,11 @@ namespace Ichni.RhythmGame
var peakField = inspector.GenerateInputField(this, container, "Peak Value", nameof(peak));
var smoothnessField = inspector.GenerateInputField(this, container, "Smoothness", nameof(smoothness));
var colorField = inspector.GenerateBaseColorPicker(this, container, "Color", nameof(color));
var intensityCurveButton = inspector.GenerateButton(this, container, "Intensity Curve", () =>
{
var intensityCurveWindow = inspector.GenerateCompositeParameterWindow(this, "Intensity Curve", nameof(intensityCurve));
intensityCurveWindow.SetAsCustomCurve();
});
container.SetDeviver(1);
}
}
@@ -64,23 +72,26 @@ namespace Ichni.RhythmGame
public float peak;
public float smoothness;
public Color color;
public AnimationCurve intensityCurve;
public VignetteEffect_BM()
{
}
public VignetteEffect_BM(float duration, float peak, float smoothness, Color color)
public VignetteEffect_BM(float duration, float peak, float smoothness, Color color, AnimationCurve intensityCurve)
{
this.effectTime = 0;
this.duration = duration;
this.peak = peak;
this.smoothness = smoothness;
this.color = color;
this.intensityCurve = intensityCurve;
}
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new VignetteEffect(duration, peak, smoothness, color);
return new VignetteEffect(duration, peak, smoothness, color, intensityCurve);
}
}
}

View File

@@ -88,7 +88,7 @@
"trackSpaceType" : 0,
"trackSamplingType" : 0,
"isClosed" : false,
"isShowingDisplay" : true,
"isShowingDisplay" : false,
"attachedElementGuid" : {
"value" : "d9d3df55-9509-46dc-8e2f-d628993313cb"
}
@@ -112,7 +112,7 @@
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.PathNode_BM,Assembly-CSharp",
"isShowingSphere" : true,
"isShowingSphere" : false,
"elementName" : "New Path Node",
"tags" : [
@@ -126,7 +126,7 @@
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 5,
"x" : 10,
"y" : 0,
"z" : 10
},
@@ -172,7 +172,7 @@
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.PathNode_BM,Assembly-CSharp",
"isShowingSphere" : true,
"isShowingSphere" : false,
"elementName" : "New Path Node",
"tags" : [
@@ -186,7 +186,7 @@
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : -5,
"x" : -10,
"y" : 0,
"z" : 10
},
@@ -231,14 +231,14 @@
"value" : "42fc001e-dd4f-4480-ab39-5e739519c068"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.Stay_BM,Assembly-CSharp",
"exactJudgeTime" : 2.5,
"elementName" : "New Stay",
"__type" : "Ichni.RhythmGame.Beatmap.Tap_BM,Assembly-CSharp",
"exactJudgeTime" : 1,
"elementName" : "New Tap",
"tags" : [
],
"elementGuid" : {
"value" : "1600949e-f6e7-4c9a-b2e2-deb6102adc58"
"value" : "336d5719-77a3-41d1-b5bc-7e358cb8b002"
},
"attachedElementGuid" : {
"value" : "d9d3df55-9509-46dc-8e2f-d628993313cb"
@@ -249,7 +249,7 @@
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "1600949e-f6e7-4c9a-b2e2-deb6102adc58"
"value" : "336d5719-77a3-41d1-b5bc-7e358cb8b002"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.NoteJudgeSubmodule_BM,Assembly-CSharp",
@@ -260,21 +260,53 @@
}
],
"attachedElementGuid" : {
"value" : "1600949e-f6e7-4c9a-b2e2-deb6102adc58"
"value" : "336d5719-77a3-41d1-b5bc-7e358cb8b002"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.Stay_BM,Assembly-CSharp",
"exactJudgeTime" : 3,
"elementName" : "New Stay",
"tags" : [
],
"elementGuid" : {
"value" : "36f8bb90-4082-4ea8-965c-b7c3ffa838f9"
},
"attachedElementGuid" : {
"value" : "d9d3df55-9509-46dc-8e2f-d628993313cb"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "36f8bb90-4082-4ea8-965c-b7c3ffa838f9"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.NoteJudgeSubmodule_BM,Assembly-CSharp",
"judgeUnitList" : [
{
"__type" : "Ichni.RhythmGame.Beatmap.TouchAreaJudgeUnit_BM,Assembly-CSharp",
"areaRadius" : 1000
}
],
"attachedElementGuid" : {
"value" : "36f8bb90-4082-4ea8-965c-b7c3ffa838f9"
}
},{
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMNoteVisual_BM,Assembly-CSharp",
"themeBundleName" : "departure_to_multiverse",
"objectName" : "DTM_NoteVisualStay",
"objectName" : "DTM_NoteVisualTap",
"elementName" : "New Note Visual",
"tags" : [
],
"elementGuid" : {
"value" : "b597deab-a232-426c-b6b4-a4247415335e"
"value" : "0f3c45f4-f76f-44f3-b195-a2af6f6221e6"
},
"attachedElementGuid" : {
"value" : "1600949e-f6e7-4c9a-b2e2-deb6102adc58"
"value" : "336d5719-77a3-41d1-b5bc-7e358cb8b002"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
@@ -294,7 +326,7 @@
"z" : 1
},
"attachedElementGuid" : {
"value" : "b597deab-a232-426c-b6b4-a4247415335e"
"value" : "0f3c45f4-f76f-44f3-b195-a2af6f6221e6"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
@@ -302,7 +334,7 @@
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "b597deab-a232-426c-b6b4-a4247415335e"
"value" : "0f3c45f4-f76f-44f3-b195-a2af6f6221e6"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ColorSubmodule_BM,Assembly-CSharp",
@@ -321,7 +353,7 @@
},
"originalEmissionIntensity" : 0,
"attachedElementGuid" : {
"value" : "b597deab-a232-426c-b6b4-a4247415335e"
"value" : "0f3c45f4-f76f-44f3-b195-a2af6f6221e6"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.EffectSubmodule_BM,Assembly-CSharp",
@@ -332,7 +364,123 @@
],"Holding":[
],"Perfect":[
{
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMNotePerfectBurst_BM,Assembly-CSharp",
"effectTime" : 0
},{
"__type" : "Ichni.RhythmGame.Beatmap.BloomEffect_BM,Assembly-CSharp",
"duration" : 0.5,
"peak" : 3,
"intensityCurve" : {
"keys" : [
{
"time" : 0,
"value" : 1,
"inTangent" : 0,
"outTangent" : 0
},{
"time" : 1,
"value" : 0,
"inTangent" : 0,
"outTangent" : 0
}
],
"preWrapMode" : 8,
"postWrapMode" : 8
},
"effectTime" : 0
}
],"Good":[
{
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMNoteGoodBurst_BM,Assembly-CSharp",
"effectTime" : 0
}
],"Bad":[
{
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMNoteBadBurst_BM,Assembly-CSharp",
"effectTime" : 0
}
],"Miss":[
]
},
"attachedElementGuid" : {
"value" : "0f3c45f4-f76f-44f3-b195-a2af6f6221e6"
}
},{
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMNoteVisual_BM,Assembly-CSharp",
"themeBundleName" : "departure_to_multiverse",
"objectName" : "DTM_NoteVisualStay",
"elementName" : "New Note Visual",
"tags" : [
],
"elementGuid" : {
"value" : "976c1bde-65be-468c-81d3-0c133f615edb"
},
"attachedElementGuid" : {
"value" : "36f8bb90-4082-4ea8-965c-b7c3ffa838f9"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "976c1bde-65be-468c-81d3-0c133f615edb"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "976c1bde-65be-468c-81d3-0c133f615edb"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ColorSubmodule_BM,Assembly-CSharp",
"originalBaseColor" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"emissionEnabled" : false,
"originalEmissionColor" : {
"r" : 0,
"g" : 0,
"b" : 0,
"a" : 1
},
"originalEmissionIntensity" : 0,
"attachedElementGuid" : {
"value" : "976c1bde-65be-468c-81d3-0c133f615edb"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.EffectSubmodule_BM,Assembly-CSharp",
"effectCollection" : {"Generate":[
],"GeneralJudge":[
],"Holding":[
],"Perfect":[
{
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMNotePerfectBurst_BM,Assembly-CSharp",
"effectTime" : 0
}
],"Good":[
],"Bad":[
@@ -342,7 +490,7 @@
]
},
"attachedElementGuid" : {
"value" : "b597deab-a232-426c-b6b4-a4247415335e"
"value" : "976c1bde-65be-468c-81d3-0c133f615edb"
}
}
],