diff --git a/Assets/Resources/Games/forkLifter.prefab b/Assets/Resources/Games/forkLifter.prefab
index 48db2abd3..afa471bdb 100644
--- a/Assets/Resources/Games/forkLifter.prefab
+++ b/Assets/Resources/Games/forkLifter.prefab
@@ -1,5 +1,89 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &1149529152017899140
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 7756588035483065508}
+ - component: {fileID: 5509506644699650990}
+ m_Layer: 0
+ m_Name: ViewerBG
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &7756588035483065508
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1149529152017899140}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0.121, y: -0.0864, z: 0}
+ m_LocalScale: {x: 2.1919, y: 2.2835865, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 5813499710761815888}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!212 &5509506644699650990
+SpriteRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1149529152017899140}
+ m_Enabled: 1
+ m_CastShadows: 0
+ m_ReceiveShadows: 0
+ m_DynamicOccludee: 1
+ m_StaticShadowCaster: 0
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 0
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 0
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: -252
+ m_Sprite: {fileID: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_FlipX: 0
+ m_FlipY: 0
+ m_DrawMode: 0
+ m_Size: {x: 1, y: 1}
+ m_AdaptiveModeThreshold: 0.5
+ m_SpriteTileMode: 0
+ m_WasSpriteAssigned: 1
+ m_MaskInteraction: 0
+ m_SpriteSortPoint: 0
--- !u!1 &2710624465797362219
GameObject:
m_ObjectHideFlags: 0
@@ -282,7 +366,9 @@ Transform:
m_LocalPosition: {x: -0.077264786, y: 0.66982126, z: 74.52776}
m_LocalScale: {x: 1.5850028, y: 1.5866843, z: 1.6180401}
m_ConstrainProportionsScale: 0
- m_Children: []
+ m_Children:
+ - {fileID: 7756588035483065508}
+ - {fileID: 4441240923074664422}
m_Father: {fileID: 5813499711174113251}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -806,6 +892,7 @@ MonoBehaviour:
currentEarlyPeasOnFork: 0
currentPerfectPeasOnFork: 0
currentLatePeasOnFork: 0
+ eatType: 0
topbun: 0
middleburger: 0
bottombun: 0
@@ -1023,6 +1110,15 @@ MonoBehaviour:
handAnim: {fileID: 5813499711174113250}
flickedObject: {fileID: 5813499710694194086}
peaPreview: {fileID: 5813499711025093251}
+ bgRecolorables:
+ - {fileID: 5813499711658895221}
+ - {fileID: 5813499710761815889}
+ gradRecolorables:
+ - {fileID: 5813499711561122392}
+ - {fileID: 5813499712485673336}
+ - {fileID: 5509506644699650990}
+ - {fileID: 1661519934678317608}
+ - {fileID: 5813499711762093784}
bg: {fileID: 5813499711658895221}
bgGradient: {fileID: 5813499711561122392}
viewerCircle: {fileID: 5813499710761815889}
@@ -1485,7 +1581,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5813499711561122393}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
- m_LocalPosition: {x: 0, y: -2.0479, z: 0}
+ m_LocalPosition: {x: 0, y: -2.36, z: 0}
m_LocalScale: {x: 134.83125, y: 2.495626, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -2447,6 +2543,90 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
+--- !u!1 &7181315906917902434
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 4441240923074664422}
+ - component: {fileID: 1661519934678317608}
+ m_Layer: 0
+ m_Name: ViewerBGExtension
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &4441240923074664422
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 7181315906917902434}
+ m_LocalRotation: {x: -0, y: -0, z: 0.96384364, w: -0.2664687}
+ m_LocalPosition: {x: 0.6536316, y: -1.0729094, z: 0}
+ m_LocalScale: {x: 0.19709346, y: 0.31798187, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 5813499710761815888}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: -149.092}
+--- !u!212 &1661519934678317608
+SpriteRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 7181315906917902434}
+ m_Enabled: 1
+ m_CastShadows: 0
+ m_ReceiveShadows: 0
+ m_DynamicOccludee: 1
+ m_StaticShadowCaster: 0
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 0
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 0
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: -252
+ m_Sprite: {fileID: 7482667652216324306, guid: 75f5f34dc1b5347e0b8351032682f224, type: 3}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_FlipX: 0
+ m_FlipY: 0
+ m_DrawMode: 0
+ m_Size: {x: 1, y: 1}
+ m_AdaptiveModeThreshold: 0.5
+ m_SpriteTileMode: 0
+ m_WasSpriteAssigned: 1
+ m_MaskInteraction: 0
+ m_SpriteSortPoint: 0
--- !u!1 &8163793729482436657
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Resources/Sprites/Games/ForkLifter/Fork Lifter 1P/GameSprites.png.meta b/Assets/Resources/Sprites/Games/ForkLifter/Fork Lifter 1P/GameSprites.png.meta
index 0b62c09ad..6ee8e4209 100644
--- a/Assets/Resources/Sprites/Games/ForkLifter/Fork Lifter 1P/GameSprites.png.meta
+++ b/Assets/Resources/Sprites/Games/ForkLifter/Fork Lifter 1P/GameSprites.png.meta
@@ -348,10 +348,10 @@ TextureImporter:
name: bg
rect:
serializedVersion: 2
- x: 4976.5967
- y: 50.7816
- width: 152.3448
- height: 1066.4136
+ x: 4977
+ y: 51
+ width: 152
+ height: 1004
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
@@ -941,7 +941,7 @@ TextureImporter:
width: 990.2412
height: 431.64362
alignment: 0
- pivot: {x: 0, y: 0}
+ pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
diff --git a/Assets/Scripts/Games/CoinToss/CoinToss.cs b/Assets/Scripts/Games/CoinToss/CoinToss.cs
index 7f14a1565..9ac52b76b 100644
--- a/Assets/Scripts/Games/CoinToss/CoinToss.cs
+++ b/Assets/Scripts/Games/CoinToss/CoinToss.cs
@@ -76,27 +76,10 @@ namespace HeavenStudio.Games
public static CoinToss instance { get; set; }
- private static Color _defaultBgColor;
- public static Color defaultBgColor
- {
- get
- {
- ColorUtility.TryParseHtmlString("#F7F742", out _defaultBgColor);
- return _defaultBgColor;
- }
- }
+ public static Color defaultBgColor = new Color(0.97f, 0.97f, 0.26f);
+ public static Color defaultFgColor = new Color(1f, 1f, 0.51f);
- private static Color _defaultFgColor;
- public static Color defaultFgColor
- {
- get
- {
- ColorUtility.TryParseHtmlString("#FFFF83", out _defaultFgColor);
- return _defaultFgColor;
- }
- }
-
[Header("Backgrounds")]
public SpriteRenderer fg;
public SpriteRenderer bg;
@@ -204,11 +187,11 @@ namespace HeavenStudio.Games
private ColorEase bgColorEase = new(defaultBgColor);
private ColorEase bgFColorEase = new(defaultBgColor);
- //call this in update
+ // call this in update
private void BackgroundColorUpdate()
{
- bg.color = GetNewColor(bgColorEase);
- fg.color = GetNewColor(bgFColorEase);
+ bg.color = bgColorEase.GetColor();
+ fg.color = bgFColorEase.GetColor();
}
public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, Color colorStartSetF, Color colorEndSetF, int ease)
diff --git a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs
index 6d149b154..12e3e3363 100644
--- a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs
+++ b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs
@@ -286,8 +286,8 @@ namespace HeavenStudio.Games
//call this in update
private void BackgroundColorUpdate()
{
- backgroundGradient.color = GetNewColor(tColorEase);
- background.color = GetNewColor(bColorEase);
+ backgroundGradient.color = tColorEase.GetColor();
+ background.color = bColorEase.GetColor();
}
public void BackgroundColor(double beat, float length, Color colorStartSetT, Color colorEndSetT, Color colorStartSetB, Color colorEndSetB, Color setStreak, int ease)
diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs
index 9c156376a..92f0e59d0 100644
--- a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs
+++ b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs
@@ -107,11 +107,8 @@ namespace HeavenStudio.Games
public Animator handAnim;
public GameObject flickedObject;
public SpriteRenderer peaPreview;
- [SerializeField] SpriteRenderer bg;
- [SerializeField] SpriteRenderer bgGradient;
- [SerializeField] SpriteRenderer viewerCircle;
- [SerializeField] SpriteRenderer playerShadow;
- [SerializeField] SpriteRenderer handShadow;
+ [SerializeField] SpriteRenderer[] bgRecolorables;
+ [SerializeField] SpriteRenderer[] gradRecolorables;
public Sprite[] peaSprites;
public Sprite[] peaHitSprites;
@@ -184,12 +181,15 @@ namespace HeavenStudio.Games
//call this in update
private void BackgroundColorUpdate()
{
- bg.color =
- viewerCircle.color =
- handShadow.color = GetNewColor(bgColorEase);
+ var bgColor = bgColorEase.GetColor();
+ foreach (var sr in bgRecolorables) {
+ sr.color = bgColor;
+ }
- bgGradient.color =
- playerShadow.color = GetNewColor(gradColorEase);
+ var gradColor = gradColorEase.GetColor();
+ foreach (var sr in gradRecolorables) {
+ sr.color = gradColor;
+ }
}
public void BackgroundColor(double beat, float length, Color startColor, Color endColor, int ease)
diff --git a/Assets/Scripts/Games/KarateMan/KarateMan.cs b/Assets/Scripts/Games/KarateMan/KarateMan.cs
index 7e6ed6fc9..07d7a57d9 100644
--- a/Assets/Scripts/Games/KarateMan/KarateMan.cs
+++ b/Assets/Scripts/Games/KarateMan/KarateMan.cs
@@ -1109,7 +1109,7 @@ namespace HeavenStudio.Games
for (int i = 0; i < spriteRenderers.Length; i++)
{
foreach (var renderer in spriteRenderers[i]) {
- renderer.color = GetNewColor(colorEases[i]);
+ renderer.color = colorEases[i].GetColor();
}
}
}
diff --git a/Assets/Scripts/Games/Kitties/Kitties.cs b/Assets/Scripts/Games/Kitties/Kitties.cs
index 4a4a8cbc8..1e815a840 100644
--- a/Assets/Scripts/Games/Kitties/Kitties.cs
+++ b/Assets/Scripts/Games/Kitties/Kitties.cs
@@ -484,7 +484,7 @@ namespace HeavenStudio.Games
//call this in update
private void BackgroundColorUpdate()
{
- background.color = GetNewColor(bgColorEase);
+ background.color = bgColorEase.GetColor();
}
public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, int ease)
diff --git a/Assets/Scripts/Games/Minigame.cs b/Assets/Scripts/Games/Minigame.cs
index 748b124e7..5abcafb02 100644
--- a/Assets/Scripts/Games/Minigame.cs
+++ b/Assets/Scripts/Games/Minigame.cs
@@ -429,14 +429,47 @@ namespace HeavenStudio.Games
#endregion
#region Color
+
+ // truly a moment in history. documentation in heaven studio :)
public class ColorEase
{
- public double startBeat;
- public float length;
- public Color startColor, endColor;
- public Util.EasingFunction.Ease ease;
+ ///
+ /// Gets the eased color from the variables inside a ColorEase.
+ /// Use this in Update().
+ ///
+ /// A new color, based on startColor and endColor.
+ public Color GetColor() => MakeNewColor(startBeat, length, startColor, endColor, easeFunc);
+ public static Color MakeNewColor(double beat, float length, Color start, Color end, Util.EasingFunction.Function func)
+ {
+ if (length != 0) {
+ float normalizedBeat = length == 0 ? 1 : Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(beat, length));
+
+ float newR = func(start.r, end.r, normalizedBeat);
+ float newG = func(start.g, end.g, normalizedBeat);
+ float newB = func(start.b, end.b, normalizedBeat);
+ return new Color(newR, newG, newB);
+ } else {
+ return end;
+ }
+ }
+
+ public double startBeat = 0;
+ public float length = 0;
+ public Color startColor, endColor = Color.white;
+ public Util.EasingFunction.Ease ease = Util.EasingFunction.Ease.Instant;
public readonly Util.EasingFunction.Function easeFunc;
+ ///
+ /// The constructor to use when constructing a ColorEase from a block.
+ ///
+ /// The start beat of the ease.
+ /// The length of the ease.
+ /// The beginning color of the ease.
+ /// The end color of the ease.
+ ///
+ /// The ease to use to transition between and .
+ /// Should be derived from Util.EasingFunction.Ease,
+ ///
public ColorEase(double startBeat, float length, Color startColor, Color endColor, int ease) {
this.startBeat = startBeat;
this.length = length;
@@ -444,31 +477,16 @@ namespace HeavenStudio.Games
this.ease = (Util.EasingFunction.Ease)ease;
this.easeFunc = Util.EasingFunction.GetEasingFunction(this.ease);
}
- public ColorEase(Color? tempColor = null) {
- startBeat = length = 0;
- startColor = endColor = (tempColor ?? Color.white);
- ease = Util.EasingFunction.Ease.Instant;
- easeFunc = Util.EasingFunction.GetEasingFunction(ease);
+
+ ///
+ /// The constructor to use when initializing the ColorEase variable.
+ ///
+ /// The default color to initialize with.
+ public ColorEase(Color? defaultColor = null) {
+ startColor = endColor = defaultColor ?? Color.white;
+ easeFunc = Util.EasingFunction.Instant;
}
}
-
- public Color GetNewColor(ColorEase ce) => GetNewColor(ce.startBeat, ce.length, ce.startColor, ce.endColor, ce.easeFunc);
- public Color GetNewColor(double beat, float length, Color start, Color end, Util.EasingFunction.Function func)
- {
- float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(beat, length));
- if (double.IsNaN(normalizedBeat)) normalizedBeat = 0; // happens if the game is stopped onto the first beat
-
- float newR = func(start.r, end.r, normalizedBeat);
- float newG = func(start.g, end.g, normalizedBeat);
- float newB = func(start.b, end.b, normalizedBeat);
-
- return new Color(newR, newG, newB);
- }
-
- // public RiqEntity PersistColor(double beat)
- // {
- //
- // }
#endregion
private void OnDestroy()
diff --git a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs
index 2edc9cc65..6bb3bf421 100644
--- a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs
+++ b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs
@@ -3,6 +3,7 @@ using UnityEngine;
using DG.Tweening;
using HeavenStudio.Util;
+using Jukebox;
namespace HeavenStudio.Games.Loaders
{
@@ -10,6 +11,18 @@ namespace HeavenStudio.Games.Loaders
public static class AgbUpbeatLoader
{
public static Minigame AddGame(EventCaller eventCaller) {
+ RiqEntity BackgroundUpdater(string datamodel, RiqEntity e)
+ {
+ if (datamodel == "mrUpbeat/changeBG" && e.dynamicData.ContainsKey("toggle"))
+ {
+ e.dynamicData.Add("ease", (int)(e["toggle"] ? Util.EasingFunction.Ease.Instant : Util.EasingFunction.Ease.Linear));
+ e.dynamicData.Remove("toggle");
+ return e;
+ }
+ return null;
+ }
+ RiqBeatmap.OnUpdateEntity += BackgroundUpdater;
+
return new Minigame("mrUpbeat", "Mr. Upbeat", "E0E0E0", false, false, new List()
{
new GameAction("prepare", "Prepare")
@@ -49,14 +62,14 @@ namespace HeavenStudio.Games.Loaders
{
function = delegate {
var e = eventCaller.currentEntity;
- MrUpbeat.instance.FadeBackgroundColor(e["start"], e["end"], e.length, e["toggle"]);
+ MrUpbeat.instance.BackgroundColor(e.beat, e.length, e["start"], e["end"], e["ease"]);
},
resizable = true,
parameters = new List()
{
new Param("start", new Color(0.878f, 0.878f, 0.878f), "Start Color", "Set the color at the start of the event."),
new Param("end", new Color(0.878f, 0.878f, 0.878f), "End Color", "Set the color at the start of the event."),
- new Param("toggle", false, "Instant", "Toggle if the background should jump to it's end state.")
+ new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the background.")
}
},
new GameAction("upbeatColors", "Upbeat Colors")
@@ -151,13 +164,14 @@ namespace HeavenStudio.Games
[SerializeField] SpriteRenderer[] shadowSr;
[Header("Properties")]
- private Tween bgColorTween;
public int stepIterate = 0;
private static double startSteppingBeat = double.MaxValue;
private static double startBlippingBeat = double.MaxValue;
private bool stopStepping;
public bool stopBlipping;
+ private ColorEase bgColorEase = new(new Color(0.878f, 0.878f, 0.878f));
+
public static MrUpbeat instance;
private void Awake()
@@ -209,9 +223,9 @@ namespace HeavenStudio.Games
public void Update()
{
- var cond = Conductor.instance;
- if (cond.isPlaying && !cond.isPaused) {
- var songPos = cond.songPositionInBeatsAsDouble;
+ bg.color = bgColorEase.GetColor();
+ if (conductor.isPlaying && !conductor.isPaused) {
+ var songPos = conductor.songPositionInBeatsAsDouble;
if (songPos >= startSteppingBeat - 2) {
man.canStep = true;
@@ -273,7 +287,6 @@ namespace HeavenStudio.Games
private void RecursiveStepping(double beat)
{
if (stopStepping) {
-
stopStepping = false;
return;
}
@@ -327,25 +340,9 @@ namespace HeavenStudio.Games
man.Fall();
}
- public void ChangeBackgroundColor(Color color1, Color color2, float beats)
+ public void BackgroundColor(double beat, float length, Color startColor, Color endColor, int ease)
{
- var seconds = Conductor.instance.secPerBeat * beats;
-
- if (bgColorTween != null)
- bgColorTween.Kill(true);
-
- if (seconds == 0) {
- bg.color = color2;
- } else {
- bg.color = color1;
- bgColorTween = bg.DOColor(color2, seconds);
- }
- }
-
- public void FadeBackgroundColor(Color start, Color end, float beats, bool instant)
- {
- ChangeBackgroundColor(start, end, 0f);
- if (!instant) ChangeBackgroundColor(start, end, beats);
+ bgColorEase = new(beat, length, startColor, endColor, ease);
}
public void UpbeatColors(Color blipColor, bool setShadow, Color shadowColor)
diff --git a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs
index e91dc6fb4..f6e87e0cb 100644
--- a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs
+++ b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs
@@ -184,15 +184,7 @@ namespace HeavenStudio.Games
}
}
- private static Color _defaultBgColor;
- public static Color defaultBgColor
- {
- get
- {
- ColorUtility.TryParseHtmlString("#A14FA1", out _defaultBgColor);
- return _defaultBgColor;
- }
- }
+ public static Color defaultBgColor = new(0.631f, 0.31f, 0.631f);
public static RhythmTweezers instance { get; set; }
private static CallAndResponseHandler crHandlerInstance;
@@ -241,8 +233,6 @@ namespace HeavenStudio.Games
private void Awake()
{
instance = this;
- colorStart = defaultBgColor;
- colorEnd = defaultBgColor;
if (crHandlerInstance != null && crHandlerInstance.queuedEvents.Count > 0)
{
foreach (var crEvent in crHandlerInstance.queuedEvents)
@@ -537,45 +527,22 @@ namespace HeavenStudio.Games
VegetableDupe.color = newColor;
}
- private double colorStartBeat = -1;
- private float colorLength = 0f;
- private Color colorStart = Color.white; //obviously put to the default color of the game
- private Color colorEnd = Color.white;
- private Util.EasingFunction.Ease colorEase; //putting Util in case this game is using jukebox
+ private ColorEase bgColorEase = new(defaultBgColor);
- //call this in update
- private void BackgroundColorUpdate()
+ public void BackgroundColor(double beat, float length, Color startColor, Color endColor, int ease)
{
- float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(colorStartBeat, colorLength));
-
- var func = Util.EasingFunction.GetEasingFunction(colorEase);
-
- float newR = func(colorStart.r, colorEnd.r, normalizedBeat);
- float newG = func(colorStart.g, colorEnd.g, normalizedBeat);
- float newB = func(colorStart.b, colorEnd.b, normalizedBeat);
-
- bg.color = new Color(newR, newG, newB);
- }
-
- public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, int ease)
- {
- colorStartBeat = beat;
- colorLength = length;
- colorStart = colorStartSet;
- colorEnd = colorEndSet;
- colorEase = (Util.EasingFunction.Ease)ease;
+ bgColorEase = new(beat, length, startColor, endColor, ease);
}
//call this in OnPlay(double beat) and OnGameSwitch(double beat)
private void PersistBlocks(double beat)
{
var allEventsBeforeBeat = GameManager.instance.Beatmap.Entities.FindAll(x => x.datamodel.Split('/')[0] == "rhythmTweezers" && x.beat < beat);
- var allColorEventsBeforeBeat = allEventsBeforeBeat.FindAll(x => x.datamodel == "rhythmTweezers/fade background color");
- if (allColorEventsBeforeBeat.Count > 0)
+ var lastColorEvent = allEventsBeforeBeat.FindLast(x => x.datamodel == "rhythmTweezers/fade background color");
+ if (lastColorEvent != null)
{
- allColorEventsBeforeBeat.Sort((x, y) => x.beat.CompareTo(y.beat)); //just in case
- var lastEvent = allColorEventsBeforeBeat[^1];
- BackgroundColor(lastEvent.beat, lastEvent.length, lastEvent["colorA"], lastEvent["colorB"], lastEvent["ease"]);
+ var e = lastColorEvent;
+ BackgroundColor(e.beat, e.length, e["colorA"], e["colorB"], e["ease"]);
}
var allAltFaceEventsBeforeBeat = allEventsBeforeBeat.FindAll(x => x.datamodel == "rhythmTweezers/altSmile");
VegetableAnimator.SetBool("UseAltSmile", allAltFaceEventsBeforeBeat.Count % 2 == 1);
@@ -627,7 +594,7 @@ namespace HeavenStudio.Games
}
}
- BackgroundColorUpdate();
+ bg.color = bgColorEase.GetColor();
}
public override void OnGameSwitch(double beat)
diff --git a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs
index 3812f9903..c91fe57e1 100644
--- a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs
+++ b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs
@@ -114,15 +114,7 @@ namespace HeavenStudio.Games
// using Scripts_SpaceDance;
public class SpaceDance : Minigame
{
- private static Color _defaultBGColor;
- public static Color defaultBGColor
- {
- get
- {
- ColorUtility.TryParseHtmlString("#0029D6", out _defaultBGColor);
- return _defaultBGColor;
- }
- }
+ public static Color defaultBGColor = new(0f, 0.161f, 0.839f);
public enum WhoSpeaks
{
Dancers = 0,
@@ -223,8 +215,6 @@ namespace HeavenStudio.Games
void Awake()
{
instance = this;
- colorStart = defaultBGColor;
- colorEnd = defaultBGColor;
SetupBopRegion("spaceDance", "bop", "auto");
}
@@ -244,7 +234,7 @@ namespace HeavenStudio.Games
void Update()
{
var cond = Conductor.instance;
- BackgroundColorUpdate();
+ bg.color = bgColorEase.GetColor();
if (cond.isPlaying && !cond.isPaused)
{
scroll.NormalizedX -= xBaseSpeed * xScrollMultiplier * Time.deltaTime;
@@ -690,33 +680,11 @@ namespace HeavenStudio.Games
Gramps.DoScaledAnimationAsync("GrampsBop", 0.5f);
}
- private double colorStartBeat = -1;
- private float colorLength = 0f;
- private Color colorStart; //obviously put to the default color of the game
- private Color colorEnd;
- private Util.EasingFunction.Ease colorEase; //putting Util in case this game is using jukebox
+ private ColorEase bgColorEase = new();
- //call this in update
- private void BackgroundColorUpdate()
+ public void BackgroundColor(double beat, float length, Color startColor, Color endColor, int ease)
{
- float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(colorStartBeat, colorLength));
-
- var func = Util.EasingFunction.GetEasingFunction(colorEase);
-
- float newR = func(colorStart.r, colorEnd.r, normalizedBeat);
- float newG = func(colorStart.g, colorEnd.g, normalizedBeat);
- float newB = func(colorStart.b, colorEnd.b, normalizedBeat);
-
- bg.color = new Color(newR, newG, newB);
- }
-
- public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, int ease)
- {
- colorStartBeat = beat;
- colorLength = length;
- colorStart = colorStartSet;
- colorEnd = colorEndSet;
- colorEase = (Util.EasingFunction.Ease)ease;
+ bgColorEase = new(beat, length, startColor, endColor, ease);
}
//call this in OnPlay(double beat) and OnGameSwitch(double beat)
diff --git a/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs b/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs
index 136096928..83124a570 100644
--- a/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs
+++ b/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs
@@ -190,15 +190,8 @@ namespace HeavenStudio.Games
Enter = 0,
Exit = 1
}
- private static Color _defaultBGColor;
- public static Color defaultBGColor
- {
- get
- {
- ColorUtility.TryParseHtmlString("#FF7D27", out _defaultBGColor);
- return _defaultBGColor;
- }
- }
+ public static Color defaultBGColor = new(1f, 0.49f, 0.153f);
+
[Header("Components")]
[SerializeField] private GameObject kickerPrefab;
[SerializeField] private GameObject ballRef;
@@ -239,8 +232,6 @@ namespace HeavenStudio.Games
private void Awake()
{
instance = this;
- colorStart = defaultBGColor;
- colorEnd = defaultBGColor;
var allHighKickToeEvents = EventCaller.GetAllInGameManagerList("spaceSoccer", new string[] { "high kick-toe!" });
foreach (var e in allHighKickToeEvents)
{
@@ -262,12 +253,12 @@ namespace HeavenStudio.Games
private void Update()
{
- var cond = Conductor.instance;
- BackgroundColorUpdate();
+ bg.color = bgColorEase.GetColor();
+ bgImage.color = dotColorEase.GetColor();
backgroundSprite.NormalizedX -= xBaseSpeed * xScrollMultiplier * Time.deltaTime;
backgroundSprite.NormalizedY += yBaseSpeed * yScrollMultiplier * Time.deltaTime;
- float normalizedEaseBeat = cond.GetPositionFromBeat(easeBeat, easeLength);
+ float normalizedEaseBeat = conductor.GetPositionFromBeat(easeBeat, easeLength);
if (normalizedEaseBeat <= 1 && normalizedEaseBeat > 0)
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase);
@@ -277,7 +268,7 @@ namespace HeavenStudio.Games
UpdateKickersPositions(newPosX, newPosY, newPosZ);
}
- float normalizedPBeat = cond.GetPositionFromBeat(easeBeatP, easeLengthP);
+ float normalizedPBeat = conductor.GetPositionFromBeat(easeBeatP, easeLengthP);
if (normalizedPBeat <= 1 && normalizedPBeat > 0)
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEaseP);
@@ -567,43 +558,18 @@ namespace HeavenStudio.Games
}
}
- private double colorStartBeat = -1;
- private float colorLength = 0f;
- private Color colorStart; //obviously put to the default color of the game
- private Color colorEnd;
- private Color colorStartDot = Color.white; //obviously put to the default color of the game
- private Color colorEndDot = Color.white;
- private Util.EasingFunction.Ease colorEase; //putting Util in case this game is using jukebox
+ private ColorEase bgColorEase = new(defaultBGColor);
+ private ColorEase dotColorEase = new(Color.white);
//call this in update
private void BackgroundColorUpdate()
{
- float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(colorStartBeat, colorLength));
-
- var func = Util.EasingFunction.GetEasingFunction(colorEase);
-
- float newR = func(colorStart.r, colorEnd.r, normalizedBeat);
- float newG = func(colorStart.g, colorEnd.g, normalizedBeat);
- float newB = func(colorStart.b, colorEnd.b, normalizedBeat);
-
- bg.color = new Color(newR, newG, newB);
-
- float newRDot = func(colorStartDot.r, colorEndDot.r, normalizedBeat);
- float newGDot = func(colorStartDot.g, colorEndDot.g, normalizedBeat);
- float newBDot = func(colorStartDot.b, colorEndDot.b, normalizedBeat);
-
- bgImage.color = new Color(newRDot, newGDot, newBDot);
}
- public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, Color colorStartDotSet, Color colorEndDotSet, int ease)
+ public void BackgroundColor(double beat, float length, Color startColorBG, Color endColorBG, Color startColorDot, Color endColorDot, int ease)
{
- colorStartBeat = beat;
- colorLength = length;
- colorStart = colorStartSet;
- colorEnd = colorEndSet;
- colorStartDot = colorStartDotSet;
- colorEndDot = colorEndDotSet;
- colorEase = (Util.EasingFunction.Ease)ease;
+ bgColorEase = new(beat, length, startColorBG, endColorBG, ease);
+ dotColorEase = new(beat, length, startColorDot, endColorDot, ease);
}
//call this in OnPlay(double beat) and OnGameSwitch(double beat)
diff --git a/Assets/Scripts/Games/Tambourine/Tambourine.cs b/Assets/Scripts/Games/Tambourine/Tambourine.cs
index dfbaf81ff..2bfb3428e 100644
--- a/Assets/Scripts/Games/Tambourine/Tambourine.cs
+++ b/Assets/Scripts/Games/Tambourine/Tambourine.cs
@@ -484,15 +484,7 @@ namespace HeavenStudio.Games
//call this in update
private void BackgroundColorUpdate()
{
- float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(colorStartBeat, colorLength));
-
- var func = Util.EasingFunction.GetEasingFunction(colorEase);
-
- float newR = func(colorStart.r, colorEnd.r, normalizedBeat);
- float newG = func(colorStart.g, colorEnd.g, normalizedBeat);
- float newB = func(colorStart.b, colorEnd.b, normalizedBeat);
-
- bg.color = new Color(newR, newG, newB);
+ bg.color = bgColorEase.GetColor();
}
public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, int ease)
diff --git a/Assets/Scripts/Games/TossBoys/TossBoys.cs b/Assets/Scripts/Games/TossBoys/TossBoys.cs
index f85d28cca..24df894d9 100644
--- a/Assets/Scripts/Games/TossBoys/TossBoys.cs
+++ b/Assets/Scripts/Games/TossBoys/TossBoys.cs
@@ -303,15 +303,7 @@ namespace HeavenStudio.Games
//call this in update
private void BackgroundColorUpdate()
{
- float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(colorStartBeat, colorLength));
-
- var func = Util.EasingFunction.GetEasingFunction(colorEase);
-
- float newR = func(colorStart.r, colorEnd.r, normalizedBeat);
- float newG = func(colorStart.g, colorEnd.g, normalizedBeat);
- float newB = func(colorStart.b, colorEnd.b, normalizedBeat);
-
- bg.color = new Color(newR, newG, newB);
+ bg.color = bgColorEase.GetColor();
}
public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, int ease)