mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 00:47:36 +02:00
Game Switch Black Flash is now beat-based. (#503)
* Game switch flashes are now 0.25 beats long * ambient glow now turns black when the game switch flash is on * you can now set the void color, it doesn't work with game switch flashes * black
This commit is contained in:
@ -25,6 +25,7 @@ namespace HeavenStudio
|
||||
private List<RiqEntity> positionEvents = new();
|
||||
private List<RiqEntity> rotationEvents = new();
|
||||
private List<RiqEntity> shakeEvents = new();
|
||||
private List<RiqEntity> colorEvents = new();
|
||||
|
||||
/**
|
||||
default cam position, for quick-resetting
|
||||
@ -61,6 +62,8 @@ namespace HeavenStudio
|
||||
[Header("Components")]
|
||||
public Color baseColor;
|
||||
|
||||
public static Color currentColor;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
@ -74,6 +77,7 @@ namespace HeavenStudio
|
||||
|
||||
ResetTransforms();
|
||||
ResetAdditionalTransforms();
|
||||
currentColor = baseColor;
|
||||
|
||||
positionLast = defaultPosition;
|
||||
rotEluerLast = defaultRotEluer;
|
||||
@ -83,6 +87,7 @@ namespace HeavenStudio
|
||||
{
|
||||
ResetTransforms();
|
||||
ResetAdditionalTransforms();
|
||||
currentColor = baseColor;
|
||||
|
||||
positionLast = defaultPosition;
|
||||
rotEluerLast = defaultRotEluer;
|
||||
@ -101,9 +106,14 @@ namespace HeavenStudio
|
||||
|
||||
shakeEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "screen shake" });
|
||||
|
||||
//color/colour time baybee
|
||||
|
||||
colorEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "camera background color" });
|
||||
|
||||
UpdateCameraTranslate();
|
||||
UpdateCameraRotate();
|
||||
SetShakeIntensity();
|
||||
UpdateCameraColor();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@ -111,6 +121,7 @@ namespace HeavenStudio
|
||||
UpdateCameraTranslate();
|
||||
UpdateCameraRotate();
|
||||
SetShakeIntensity();
|
||||
UpdateCameraColor();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
@ -121,6 +132,29 @@ namespace HeavenStudio
|
||||
cam.transform.localPosition = userPos + additionalPosition + shakeResult;
|
||||
cam.transform.eulerAngles = rotEluer + additionalRotEluer;
|
||||
cam.fieldOfView = additionalFoV;
|
||||
cam.backgroundColor = currentColor;
|
||||
if (!StaticCamera.instance.usingMinigameAmbientColor) StaticCamera.instance.SetAmbientGlowColour(currentColor, false, false);
|
||||
}
|
||||
|
||||
private void UpdateCameraColor()
|
||||
{
|
||||
foreach (var e in colorEvents)
|
||||
{
|
||||
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||
if (prog >= 0f)
|
||||
{
|
||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
||||
float newColorR = func(e["color"].r, e["color2"].r, prog);
|
||||
float newColorG = func(e["color"].g, e["color2"].g, prog);
|
||||
float newColorB = func(e["color"].b, e["color2"].b, prog);
|
||||
|
||||
currentColor = new Color(newColorR, newColorG, newColorB);
|
||||
}
|
||||
if (prog > 1f)
|
||||
{
|
||||
currentColor = e["color2"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCameraTranslate()
|
||||
|
Reference in New Issue
Block a user