CameraTilt初步

This commit is contained in:
SoulliesOfficial
2025-05-31 00:48:35 -04:00
parent 5032b342fa
commit e7f7230846
13 changed files with 16905 additions and 18033 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -55,6 +55,8 @@ MonoBehaviour:
type: 3}
cameraShakeEffect: {fileID: 5030288017655597913, guid: 46175bea33f87445bbec1389a53da172,
type: 3}
cameraTiltEffect: {fileID: 5030288017655597913, guid: 34f35091439de454483d8f703662fe18,
type: 3}
chromaticAberrationEffect: {fileID: 5030288017655597913, guid: 4d005c2b7c6d64702878b4c578f5970c,
type: 3}
vignetteEffect: {fileID: 5030288017655597913, guid: 7c3d54fe8d65c4f70a69073c45555dae,

View File

@@ -75,7 +75,7 @@ MonoBehaviour:
parentElement: {fileID: 0}
connectedTab: {fileID: 0}
childElementList: []
camera: {fileID: 1378655914364111770}
gameCamera: {fileID: 1378655914364111770}
rotationPoint: {fileID: 373065448631755357}
positionPoint: {fileID: 2202765603615894048}
cameraTransform: {fileID: 4681825519897212372}

View File

@@ -0,0 +1,391 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5030288017655597913
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6794014747502131782}
- component: {fileID: 2505559936379693214}
m_Layer: 0
m_Name: CameraTiltEffect
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6794014747502131782
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5030288017655597913}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2505559936379693214
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5030288017655597913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6da43522623d4704e979466dc7650b65, type: 3}
m_Name:
m_EditorClassIdentifier:
Feedbacks: []
InitializationMode: 2
AutoInitialization: 1
SafeMode: 3
Direction: 0
AutoChangeDirectionOnEnd: 0
AutoPlayOnStart: 0
AutoPlayOnEnable: 0
ForceTimescaleMode: 0
ForcedTimescaleMode: 1
DurationMultiplier: 1
TimescaleMultiplier: 1
RandomizeDuration: 0
RandomDurationMultiplier: {x: 0.5, y: 1.5}
DisplayFullDurationDetails: 0
PlayerTimescaleMode: 1
OnlyPlayIfWithinRange: 0
RangeCenter: {fileID: 0}
RangeDistance: 5
UseRangeFalloff: 0
RangeFalloff:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
RemapRangeFalloff: {x: 0, y: 1}
IgnoreRangeEvents: 0
CooldownDuration: 0
InitialDelay: 0
CanPlay: 1
CanPlayWhileAlreadyPlaying: 1
ChanceToPlay: 100
FeedbacksIntensity: 1
Events:
TriggerMMFeedbacksEvents: 0
TriggerUnityEvents: 1
OnPlay:
m_PersistentCalls:
m_Calls: []
OnPause:
m_PersistentCalls:
m_Calls: []
OnResume:
m_PersistentCalls:
m_Calls: []
OnRevert:
m_PersistentCalls:
m_Calls: []
OnComplete:
m_PersistentCalls:
m_Calls: []
OnRestoreInitialValues:
m_PersistentCalls:
m_Calls: []
OnSkipToTheEnd:
m_PersistentCalls:
m_Calls: []
OnInitializationComplete:
m_PersistentCalls:
m_Calls: []
OnEnable:
m_PersistentCalls:
m_Calls: []
OnDisable:
m_PersistentCalls:
m_Calls: []
DebugActive: 0
FeedbacksList:
- rid: 7796554095956328451
KeepPlayModeChanges: 0
PerformanceMode: 0
StopFeedbacksOnDisable: 0
PlayCount: 0
references:
version: 2
RefIds:
- rid: 7796554095956328451
type: {class: MMF_Rotation, ns: MoreMountains.Feedbacks, asm: MoreMountains.Tools}
data:
Active: 1
UniqueID: -539086181
Label: Rotation
ChannelMode: 0
Channel: 0
MMChannelDefinition: {fileID: 0}
Chance: 100
DisplayColor: {r: 0, g: 0, b: 0, a: 1}
Timing:
TimescaleMode: 0
ExcludeFromHoldingPauses: 0
ContributeToTotalDuration: 1
InitialDelay: 0
CooldownDuration: 0
InterruptsOnStop: 1
NumberOfRepeats: 0
RepeatForever: 0
DelayBetweenRepeats: 1
PlayCount: 0
LimitPlayCount: 0
MaxPlayCount: 3
SetPlayCountToZeroOnReset: 0
MMFeedbacksDirectionCondition: 0
PlayDirection: 0
ConstantIntensity: 0
UseIntensityInterval: 0
IntensityIntervalMin: 0
IntensityIntervalMax: 0
Sequence: {fileID: 0}
TrackID: 0
Quantized: 0
TargetBPM: 120
AutomatedTargetAcquisition:
Mode: 0
ChildIndex: 0
RandomizeOutput: 0
RandomMultiplier: {x: 0.8, y: 1}
RandomizeDuration: 0
RandomDurationMultiplier: {x: 0.5, y: 2}
UseRange: 0
RangeDistance: 5
UseRangeFalloff: 0
RangeFalloff:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
RemapRangeFalloff: {x: 0, y: 1}
AutomaticShakerSetupButton:
ButtonText:
Owner: {fileID: 2505559936379693214}
DebugActive: 0
AnimateRotationTarget: {fileID: 0}
Mode: 1
RotationSpace: 1
AnimateRotationDuration: 0.2
RemapCurveZero: 0
RemapCurveOne: 360
AnimateX: 0
AnimateRotationTweenX:
MMTweenDefinitionType: 1
MMTweenCurve: 4
Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.3
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
Initialized: 0
AnimateY: 0
AnimateRotationTweenY:
MMTweenDefinitionType: 1
MMTweenCurve: 4
Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.3
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
Initialized: 0
AnimateZ: 1
AnimateRotationTweenZ:
MMTweenDefinitionType: 1
MMTweenCurve: 4
Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.3
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
Initialized: 0
AllowAdditivePlays: 0
DetermineRotationOnPlay: 0
ToDestinationSpace: 0
DestinationAngles: {x: 0, y: 180, z: 0}
ToDestinationTween:
MMTweenDefinitionType: 0
MMTweenCurve: 10
Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
Initialized: 0
AnimateRotationX:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
AnimateRotationY:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
AnimateRotationZ:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
ToDestinationCurve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 34f35091439de454483d8f703662fe18
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -24,5 +24,22 @@ namespace Ichni
keys[2] = new Keyframe(totalTime, startValue, 0, 0);
return new AnimationCurve(keys);
}
/// <summary>
/// 自定义峰值点位置的抛物线曲线,在指定时间点达到最大值,两端为起始值
/// </summary>
/// <param name="totalTime">总时间</param>
/// <param name="startValue">起始(和结束)值</param>
/// <param name="peakValue">最大值</param>
/// <param name="peakTimePercent">最大值的比例点</param>
/// <returns></returns>
public static AnimationCurve CustomPeakTimeParabolic(float totalTime, float startValue, float peakValue, float peakTimePercent)
{
Keyframe[] keys = new Keyframe[3];
keys[0] = new Keyframe(0, startValue, 0, 0);
keys[1] = new Keyframe(totalTime * peakTimePercent, peakValue, 0, 0);
keys[2] = new Keyframe(totalTime, startValue, 0, 0);
return new AnimationCurve(keys);
}
}
}

View File

@@ -127,6 +127,7 @@ namespace Ichni.RhythmGame
{
{ "Bloom", new BloomEffect(1, 2, CustomCurvePresets.Parabolic(1, 0, 1)) },
{ "CameraShake", new CameraShakeEffect(1, 50, 1, 1, 1) },
{"CameraTilt", new CameraTiltEffect(0.2f, 15f, CustomCurvePresets.CustomPeakTimeParabolic(1,0,1, 0.3f))},
{ "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) },

View File

@@ -0,0 +1,85 @@
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 CameraTiltEffect : EffectBase
{
public float duration;
public float peakZ;
public AnimationCurve tiltCurve;
public CameraTiltEffect(float duration, float peakZ, AnimationCurve tiltCurve)
{
this.effectTime = 0;
this.duration = duration;
this.peakZ = peakZ;
this.tiltCurve = tiltCurve;
}
public override void Adjust()
{
if (!EditorManager.instance.cameraManager.haveGameCamera)
{
LogWindow.Log("No game camera found, cannot apply camera tilt effect.", Color.yellow);
return;
}
MMF_Player effect = LeanPool.Spawn(EditorManager.instance.basePrefabs.cameraTiltEffect).GetComponent<MMF_Player>();
effect.GetFeedbackOfType<MMF_Rotation>().AnimateRotationTarget = EditorManager.instance.cameraManager.gameCamera.gameCamera.transform;
effect.GetFeedbackOfType<MMF_Rotation>().AnimateRotationDuration = duration;
effect.GetFeedbackOfType<MMF_Rotation>().RemapCurveOne = peakZ;
effect.GetFeedbackOfType<MMF_Rotation>().AnimateRotationZ = tiltCurve;
effect.PlayFeedbacks();
LeanPool.Despawn(effect.gameObject, duration);
}
public override EffectBase_BM ConvertToBM()
{
return new CameraTiltEffect_BM(duration, peakZ, tiltCurve);
}
public override void SetUpInspector()
{
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Camera Tilt");
var effectSettings = container.GenerateSubcontainer(3);
var effectTimeField = inspector.GenerateInputField(this, effectSettings, "Duration", nameof(duration));
var bloomPeakField = inspector.GenerateInputField(this, effectSettings, "Z Peak Value", nameof(peakZ));
var intensityCurveButton = inspector.GenerateButton(this, effectSettings, "Intensity Curve", () =>
{
var intensityCurveWindow =
inspector.GenerateCompositeParameterWindow(this, "Tilt Curve", nameof(tiltCurve)).SetAsCustomCurve();
});
}
}
namespace Beatmap
{
public class CameraTiltEffect_BM : EffectBase_BM
{
public float duration;
public float peakZ;
public AnimationCurve tiltCurve;
public CameraTiltEffect_BM(float duration, float peakZ, AnimationCurve tiltCurve)
{
this.effectTime = 0;
this.duration = duration;
this.peakZ = peakZ;
this.tiltCurve = tiltCurve;
}
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new CameraTiltEffect(duration, peakZ, tiltCurve);
}
}
}
}

View File

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

View File

@@ -35,7 +35,7 @@ namespace Ichni.RhythmGame
public override EffectBase_BM ConvertToBM()
{
return new ChromaticAberrationEffect_BM(duration, peak);
return new ChromaticAberrationEffect_BM(duration, peak, intensityCurve);
}
public override void SetUpInspector()
@@ -66,11 +66,12 @@ namespace Ichni.RhythmGame
}
public ChromaticAberrationEffect_BM(float duration, float peak)
public ChromaticAberrationEffect_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)

View File

@@ -33,6 +33,7 @@ public class BasePrefabsCollection : SerializedScriptableObject
[Title("Effect相关")]
public GameObject bloomEffect;
public GameObject cameraShakeEffect;
public GameObject cameraTiltEffect;
public GameObject chromaticAberrationEffect;
public GameObject vignetteEffect;
public GameObject lowPassFilterEffect;

File diff suppressed because one or more lines are too long