Camera Tilt和Camera Offset效果,以及退出,重载功能
This commit is contained in:
@@ -127,7 +127,10 @@ 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))},
|
||||
{"CameraOffset", new CameraOffsetEffect(0.2f, Vector3.forward, CustomCurvePresets.CustomPeakTimeParabolic(1,0,1,0.3f))},
|
||||
{"CameraTilt", new CameraTiltEffect(false, 0.2f, 5f, CustomCurvePresets.CustomPeakTimeParabolic(1,0,1, 0.3f),
|
||||
false, 0.2f, 5f, CustomCurvePresets.CustomPeakTimeParabolic(1,0,1, 0.3f),
|
||||
false, 0.2f, 5f, 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) },
|
||||
|
||||
@@ -89,6 +89,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
EditorManager.instance.beatmapContainer = new BeatmapContainer();
|
||||
EditorManager.instance.beatmapContainer.matchedBM = this;
|
||||
GameElement_BM.identifier.Clear();
|
||||
|
||||
elementList.ForEach(element =>
|
||||
{
|
||||
|
||||
@@ -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 UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class CameraOffsetEffect : EffectBase
|
||||
{
|
||||
public float duration;
|
||||
public Vector3 offsetPeak;
|
||||
public AnimationCurve offsetCurve;
|
||||
|
||||
public CameraOffsetEffect(float duration, Vector3 offsetPeak, AnimationCurve offsetCurve)
|
||||
{
|
||||
this.effectTime = 0;
|
||||
this.duration = duration;
|
||||
this.offsetPeak = offsetPeak;
|
||||
this.offsetCurve = offsetCurve;
|
||||
}
|
||||
|
||||
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_Position>().AnimatePositionTarget = EditorManager.instance.cameraManager.gameCamera.gameCamera.gameObject;
|
||||
effect.GetFeedbackOfType<MMF_Position>().AnimatePositionDuration = duration;
|
||||
effect.GetFeedbackOfType<MMF_Position>().DestinationPosition = offsetPeak;
|
||||
effect.GetFeedbackOfType<MMF_Position>().AnimatePositionCurve = offsetCurve;
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, duration);
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new CameraOffsetEffect_BM(duration, offsetPeak, offsetCurve);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Camera Tilt");
|
||||
var subcontainer1 = container.GenerateSubcontainer(3);
|
||||
var durationField = inspector.GenerateInputField(this, subcontainer1, "Duration", nameof(duration));
|
||||
var curveButton = inspector.GenerateButton(this, subcontainer1, "Offset Curve", () =>
|
||||
{
|
||||
var intensityCurveWindow =
|
||||
inspector.GenerateCompositeParameterWindow(this, "Tilt Curve", nameof(offsetCurve)).SetAsCustomCurve();
|
||||
});
|
||||
var subcontainer2 = container.GenerateSubcontainer(3);
|
||||
var xPeakField = inspector.GenerateVector3InputField(this, subcontainer2, "Offset Peak", nameof(offsetPeak));
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class CameraOffsetEffect_BM : EffectBase_BM
|
||||
{
|
||||
public float duration;
|
||||
public Vector3 offsetPeak;
|
||||
public AnimationCurve offsetCurve;
|
||||
|
||||
public CameraOffsetEffect_BM(float duration, Vector3 offsetPeak, AnimationCurve offsetCurve)
|
||||
{
|
||||
this.duration = duration;
|
||||
this.offsetPeak = offsetPeak;
|
||||
this.offsetCurve = offsetCurve;
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
|
||||
{
|
||||
return new CameraOffsetEffect(duration, offsetPeak, offsetCurve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecf5a81a3dbf2dc4d83fdd949763835b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,16 +11,41 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public class CameraTiltEffect : EffectBase
|
||||
{
|
||||
public float duration;
|
||||
public float peakZ;
|
||||
public AnimationCurve tiltCurve;
|
||||
public bool haveXTilt;
|
||||
public float xDuration;
|
||||
public float xPeak;
|
||||
public AnimationCurve tiltCurveX;
|
||||
|
||||
public CameraTiltEffect(float duration, float peakZ, AnimationCurve tiltCurve)
|
||||
public bool haveYTilt;
|
||||
public float yDuration;
|
||||
public float yPeak;
|
||||
public AnimationCurve tiltCurveY;
|
||||
|
||||
public bool haveZTilt;
|
||||
public float zDuration;
|
||||
public float zPeak;
|
||||
public AnimationCurve tiltCurveZ;
|
||||
|
||||
public CameraTiltEffect(bool haveXTilt, float xDuration, float xPeak, AnimationCurve tiltCurveX,
|
||||
bool haveYTilt, float yDuration, float yPeak, AnimationCurve tiltCurveY,
|
||||
bool haveZTilt, float zDuration, float zPeak, AnimationCurve tiltCurveZ)
|
||||
{
|
||||
this.effectTime = 0;
|
||||
this.duration = duration;
|
||||
this.peakZ = peakZ;
|
||||
this.tiltCurve = tiltCurve;
|
||||
|
||||
this.haveXTilt = haveXTilt;
|
||||
this.xDuration = xDuration;
|
||||
this.xPeak = xPeak;
|
||||
this.tiltCurveX = tiltCurveX;
|
||||
|
||||
this.haveYTilt = haveYTilt;
|
||||
this.yDuration = yDuration;
|
||||
this.yPeak = yPeak;
|
||||
this.tiltCurveY = tiltCurveY;
|
||||
|
||||
this.haveZTilt = haveZTilt;
|
||||
this.zDuration = zDuration;
|
||||
this.zPeak = zPeak;
|
||||
this.tiltCurveZ = tiltCurveZ;
|
||||
}
|
||||
|
||||
public override void Adjust()
|
||||
@@ -31,31 +56,89 @@ namespace Ichni.RhythmGame
|
||||
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);
|
||||
if (haveXTilt)
|
||||
{
|
||||
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 = xDuration;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateX = true;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateY = false;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateZ = false;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().RemapCurveOne = xPeak;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateRotationX = tiltCurveX;
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, xDuration);
|
||||
}
|
||||
|
||||
if (haveYTilt)
|
||||
{
|
||||
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 = yDuration;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateX = false;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateY = true;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateZ = false;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().RemapCurveOne = yPeak;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateRotationY = tiltCurveY;
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, yDuration);
|
||||
}
|
||||
|
||||
if (haveZTilt)
|
||||
{
|
||||
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 = zDuration;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateX = false;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateZ = true;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateY = false;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().RemapCurveOne = zPeak;
|
||||
effect.GetFeedbackOfType<MMF_Rotation>().AnimateRotationZ = tiltCurveZ;
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, zDuration);
|
||||
}
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new CameraTiltEffect_BM(duration, peakZ, tiltCurve);
|
||||
return new CameraTiltEffect_BM(
|
||||
haveXTilt, xDuration, xPeak, tiltCurveX,
|
||||
haveYTilt, yDuration, yPeak, tiltCurveY,
|
||||
haveZTilt, zDuration, zPeak, tiltCurveZ);
|
||||
}
|
||||
|
||||
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 xSubcontainer= container.GenerateSubcontainer(3);
|
||||
var haveXTileToggle = inspector.GenerateToggle(this, xSubcontainer, "Have X Tilt", nameof(haveXTilt));
|
||||
var xDurationField = inspector.GenerateInputField(this, xSubcontainer, "Duration", nameof(xDuration));
|
||||
var xPeakField = inspector.GenerateInputField(this, xSubcontainer, "X Peak Value", nameof(xPeak));
|
||||
var xCurveButton = inspector.GenerateButton(this, xSubcontainer, "Intensity Curve", () =>
|
||||
{
|
||||
var intensityCurveWindow =
|
||||
inspector.GenerateCompositeParameterWindow(this, "Tilt Curve", nameof(tiltCurve)).SetAsCustomCurve();
|
||||
inspector.GenerateCompositeParameterWindow(this, "Tilt Curve", nameof(tiltCurveX)).SetAsCustomCurve();
|
||||
});
|
||||
|
||||
var ySubcontainer = container.GenerateSubcontainer(3);
|
||||
var haveYTileToggle = inspector.GenerateToggle(this, ySubcontainer, "Have Y Tilt", nameof(haveYTilt));
|
||||
var yDurationField = inspector.GenerateInputField(this, ySubcontainer, "Duration", nameof(yDuration));
|
||||
var yPeakField = inspector.GenerateInputField(this, ySubcontainer, "Y Peak Value", nameof(yPeak));
|
||||
var yCurveButton = inspector.GenerateButton(this, ySubcontainer, "Intensity Curve", () =>
|
||||
{
|
||||
var intensityCurveWindow =
|
||||
inspector.GenerateCompositeParameterWindow(this, "Tilt Curve", nameof(tiltCurveY)).SetAsCustomCurve();
|
||||
});
|
||||
|
||||
var zSubcontainer = container.GenerateSubcontainer(3);
|
||||
var haveZTileToggle = inspector.GenerateToggle(this, zSubcontainer, "Have Z Tilt", nameof(haveZTilt));
|
||||
var zDurationField = inspector.GenerateInputField(this, zSubcontainer, "Duration", nameof(zDuration));
|
||||
var zPeakField = inspector.GenerateInputField(this, zSubcontainer, "Z Peak Value", nameof(zPeak));
|
||||
var zCurveButton = inspector.GenerateButton(this, zSubcontainer, "Intensity Curve", () =>
|
||||
{
|
||||
var intensityCurveWindow =
|
||||
inspector.GenerateCompositeParameterWindow(this, "Tilt Curve", nameof(tiltCurveZ)).SetAsCustomCurve();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -64,21 +147,45 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public class CameraTiltEffect_BM : EffectBase_BM
|
||||
{
|
||||
public float duration;
|
||||
public float peakZ;
|
||||
public AnimationCurve tiltCurve;
|
||||
|
||||
public CameraTiltEffect_BM(float duration, float peakZ, AnimationCurve tiltCurve)
|
||||
public bool haveXTilt;
|
||||
public float xDuration;
|
||||
public float xPeak;
|
||||
public AnimationCurve tiltCurveX;
|
||||
|
||||
public bool haveYTilt;
|
||||
public float yDuration;
|
||||
public float yPeak;
|
||||
public AnimationCurve tiltCurveY;
|
||||
|
||||
public bool haveZTilt;
|
||||
public float zDuration;
|
||||
public float zPeak;
|
||||
public AnimationCurve tiltCurveZ;
|
||||
public CameraTiltEffect_BM(bool haveXTilt, float xDuration, float xPeak, AnimationCurve tiltCurveX,
|
||||
bool haveYTilt, float yDuration, float yPeak, AnimationCurve tiltCurveY,
|
||||
bool haveZTilt, float zDuration, float zPeak, AnimationCurve tiltCurveZ)
|
||||
{
|
||||
this.effectTime = 0;
|
||||
this.duration = duration;
|
||||
this.peakZ = peakZ;
|
||||
this.tiltCurve = tiltCurve;
|
||||
|
||||
this.haveXTilt = haveXTilt;
|
||||
this.xDuration = xDuration;
|
||||
this.xPeak = xPeak;
|
||||
this.tiltCurveX = tiltCurveX;
|
||||
this.haveYTilt = haveYTilt;
|
||||
this.yDuration = yDuration;
|
||||
this.yPeak = yPeak;
|
||||
this.tiltCurveY = tiltCurveY;
|
||||
this.haveZTilt = haveZTilt;
|
||||
this.zDuration = zDuration;
|
||||
this.zPeak = zPeak;
|
||||
this.tiltCurveZ = tiltCurveZ;
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
|
||||
{
|
||||
return new CameraTiltEffect(duration, peakZ, tiltCurve);
|
||||
return new CameraTiltEffect(haveXTilt, xDuration, xPeak, tiltCurveX,
|
||||
haveYTilt, yDuration, yPeak, tiltCurveY,
|
||||
haveZTilt, zDuration, zPeak, tiltCurveZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Ichni.RhythmGame
|
||||
public float areaRadius;
|
||||
protected override GameObject GetHintImagePrefab() => EditorManager.instance.basePrefabs.areaHint;
|
||||
|
||||
private float CurrentScreenRatio() => Screen.width / 1920f;
|
||||
private float CurrentScreenRatio() => Screen.height / 1080f;
|
||||
|
||||
public TouchAreaJudgeUnit(NoteBase note, float areaRadius) : base(note)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user