diff --git a/Assets/Resources/Games/cannery.prefab b/Assets/Resources/Games/cannery.prefab
index d0e374735..27646197f 100644
--- a/Assets/Resources/Games/cannery.prefab
+++ b/Assets/Resources/Games/cannery.prefab
@@ -1264,6 +1264,11 @@ MonoBehaviour:
alarmAnim: {fileID: 3637100343128600021}
dingAnim: {fileID: 7386547292618809648}
cannerAnim: {fileID: 7509521705116870356}
+ aStartBeat: 0
+ aLength: 0
+ aStartColor: {r: 0, g: 0, b: 0, a: 0}
+ aEndColor: {r: 0, g: 0, b: 0, a: 0}
+ aEase: 0
--- !u!1 &5862740553224149703
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Resources/Sfx/nearMiss.mp3 b/Assets/Resources/Sfx/nearMiss.mp3
deleted file mode 100644
index d868f5103..000000000
Binary files a/Assets/Resources/Sfx/nearMiss.mp3 and /dev/null differ
diff --git a/Assets/Resources/Sfx/nearMiss.ogg b/Assets/Resources/Sfx/nearMiss.ogg
new file mode 100644
index 000000000..3503d75f4
Binary files /dev/null and b/Assets/Resources/Sfx/nearMiss.ogg differ
diff --git a/Assets/Resources/Sfx/nearMiss.mp3.meta b/Assets/Resources/Sfx/nearMiss.ogg.meta
similarity index 91%
rename from Assets/Resources/Sfx/nearMiss.mp3.meta
rename to Assets/Resources/Sfx/nearMiss.ogg.meta
index 48e7b0a5d..d40c92ed3 100644
--- a/Assets/Resources/Sfx/nearMiss.mp3.meta
+++ b/Assets/Resources/Sfx/nearMiss.ogg.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: f5fbcd0de07ecb7429a3bb75da47ea60
+guid: 84ae0c5188393c54f8d34a331631e549
AudioImporter:
externalObjects: {}
serializedVersion: 6
diff --git a/Assets/Resources/Sprites/Editor/GameIcons/cannery.png b/Assets/Resources/Sprites/Editor/GameIcons/cannery.png
new file mode 100644
index 000000000..8cc7dbe4a
Binary files /dev/null and b/Assets/Resources/Sprites/Editor/GameIcons/cannery.png differ
diff --git a/Assets/Resources/Sprites/Editor/GameIcons/cannery.png.meta b/Assets/Resources/Sprites/Editor/GameIcons/cannery.png.meta
new file mode 100644
index 000000000..6c82703fa
--- /dev/null
+++ b/Assets/Resources/Sprites/Editor/GameIcons/cannery.png.meta
@@ -0,0 +1,123 @@
+fileFormatVersion: 2
+guid: 5b787766f3f00a046a24d5ccbbd9133d
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 12
+ mipmaps:
+ mipMapMode: 1
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ ignoreMasterTextureLimit: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 2
+ aniso: 8
+ mipBias: 0
+ wrapU: 1
+ wrapV: 1
+ wrapW: 1
+ nPOTScale: 0
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 1
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 8
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ cookieLightType: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 256
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Server
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID: 5e97eb03825dee720800000000000000
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ nameFileIdTable: {}
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Resources/Sprites/Editor/GameIcons/cannery_mask.png b/Assets/Resources/Sprites/Editor/GameIcons/cannery_mask.png
new file mode 100644
index 000000000..f71b0fc1a
Binary files /dev/null and b/Assets/Resources/Sprites/Editor/GameIcons/cannery_mask.png differ
diff --git a/Assets/Resources/Sprites/Editor/GameIcons/cannery_mask.png.meta b/Assets/Resources/Sprites/Editor/GameIcons/cannery_mask.png.meta
new file mode 100644
index 000000000..12d34a38d
--- /dev/null
+++ b/Assets/Resources/Sprites/Editor/GameIcons/cannery_mask.png.meta
@@ -0,0 +1,123 @@
+fileFormatVersion: 2
+guid: 4289aad5e58f9d548892576c6db75165
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 12
+ mipmaps:
+ mipMapMode: 1
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ ignoreMasterTextureLimit: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 2
+ aniso: 8
+ mipBias: 0
+ wrapU: 1
+ wrapV: 1
+ wrapW: 1
+ nPOTScale: 0
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 1
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 8
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ cookieLightType: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 256
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Server
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID: 5e97eb03825dee720800000000000000
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ nameFileIdTable: {}
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Resources/Sprites/Games/Cannery/AlarmMat.mat b/Assets/Resources/Sprites/Games/Cannery/AlarmMat.mat
index 92bdac5b6..9f0325306 100644
--- a/Assets/Resources/Sprites/Games/Cannery/AlarmMat.mat
+++ b/Assets/Resources/Sprites/Games/Cannery/AlarmMat.mat
@@ -84,7 +84,7 @@ Material:
m_Colors:
- _AddColor: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- - _ColorAlpha: {r: 0.862, g: 0.372, b: 0.031, a: 1}
+ - _ColorAlpha: {r: 0.8627, g: 0.3725, b: 0.0313, a: 1}
- _ColorBravo: {r: 0.49803922, g: 0.49803922, b: 0.5058824, a: 1}
- _ColorDelta: {r: 0.24705882, g: 0.24313726, b: 0.24705882, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
diff --git a/Assets/Resources/Sprites/Games/Cannery/Animations/Can/CanAnim.controller b/Assets/Resources/Sprites/Games/Cannery/Animations/Can/CanAnim.controller
index f802c868a..2ba2c47ec 100644
--- a/Assets/Resources/Sprites/Games/Cannery/Animations/Can/CanAnim.controller
+++ b/Assets/Resources/Sprites/Games/Cannery/Animations/Can/CanAnim.controller
@@ -40,10 +40,10 @@ AnimatorStateMachine:
m_Position: {x: 280, y: 110, z: 0}
- serializedVersion: 1
m_State: {fileID: 671542589843244340}
- m_Position: {x: 280, y: 180, z: 0}
+ m_Position: {x: 280, y: 170, z: 0}
- serializedVersion: 1
m_State: {fileID: 808679152055322211}
- m_Position: {x: 280, y: 240, z: 0}
+ m_Position: {x: 280, y: 230, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
@@ -203,13 +203,13 @@ AnimatorStateMachine:
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -7318305927348823551}
- m_Position: {x: 280, y: 180, z: 0}
+ m_Position: {x: 280, y: 170, z: 0}
- serializedVersion: 1
m_State: {fileID: -3105581592757715715}
m_Position: {x: 280, y: 110, z: 0}
- serializedVersion: 1
m_State: {fileID: 7320030847503406928}
- m_Position: {x: 280, y: 240, z: 0}
+ m_Position: {x: 280, y: 230, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
diff --git a/Assets/Resources/Sprites/Games/Cannery/Animations/Can/CanReopen.anim b/Assets/Resources/Sprites/Games/Cannery/Animations/Can/CanReopen.anim
index 87284aec0..8052f14d8 100644
--- a/Assets/Resources/Sprites/Games/Cannery/Animations/Can/CanReopen.anim
+++ b/Assets/Resources/Sprites/Games/Cannery/Animations/Can/CanReopen.anim
@@ -219,7 +219,7 @@ AnimationClip:
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
- m_LoopTime: 1
+ m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
diff --git a/Assets/Resources/Sprites/Games/Cannery/Animations/Canner/CannerAnim.controller b/Assets/Resources/Sprites/Games/Cannery/Animations/Canner/CannerAnim.controller
index ed9c57311..281a3ac44 100644
--- a/Assets/Resources/Sprites/Games/Cannery/Animations/Canner/CannerAnim.controller
+++ b/Assets/Resources/Sprites/Games/Cannery/Animations/Canner/CannerAnim.controller
@@ -33,7 +33,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
- m_Name: CannerCanBarely
+ m_Name: CanBarely
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@@ -146,7 +146,7 @@ AnimatorStateMachine:
m_Position: {x: 279.17062, y: 256.5166, z: 0}
- serializedVersion: 1
m_State: {fileID: -4925777547588300938}
- m_Position: {x: 314.17062, y: 321.5166, z: 0}
+ m_Position: {x: 280, y: 330, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
diff --git a/Assets/Resources/Sprites/Games/Cannery/Animations/Canner/CannerCanBarely.anim b/Assets/Resources/Sprites/Games/Cannery/Animations/Canner/CannerCanBarely.anim
index 6a91cf110..bb4440dac 100644
--- a/Assets/Resources/Sprites/Games/Cannery/Animations/Canner/CannerCanBarely.anim
+++ b/Assets/Resources/Sprites/Games/Cannery/Animations/Canner/CannerCanBarely.anim
@@ -604,7 +604,7 @@ AnimationClip:
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
- m_LoopTime: 1
+ m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
diff --git a/Assets/Resources/Sprites/Games/Cannery/Animations/ConveyorBelt/ConveyorBeltMove.anim b/Assets/Resources/Sprites/Games/Cannery/Animations/ConveyorBelt/ConveyorBeltMove.anim
index ad566eb1f..b768bed12 100644
--- a/Assets/Resources/Sprites/Games/Cannery/Animations/ConveyorBelt/ConveyorBeltMove.anim
+++ b/Assets/Resources/Sprites/Games/Cannery/Animations/ConveyorBelt/ConveyorBeltMove.anim
@@ -20,17 +20,17 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
- value: {x: -9.62, y: -4.782, z: 0}
+ value: {x: -10.583, y: -4.782, z: 0}
inSlope: {x: 0, y: 0, z: 0}
- outSlope: {x: 115.439995, y: 0, z: 0}
+ outSlope: {x: 132.498, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.16666667
- value: {x: 9.62, y: -4.782, z: 0}
- inSlope: {x: 115.439995, y: 0, z: 0}
+ value: {x: 11.5, y: -4.782, z: 0}
+ inSlope: {x: 132.498, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
@@ -84,17 +84,17 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
- value: -9.62
+ value: -10.583
inSlope: 0
- outSlope: 115.439995
+ outSlope: 132.498
tangentMode: 69
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.16666667
- value: 9.62
- inSlope: 115.439995
+ value: 11.5
+ inSlope: 132.498
outSlope: 0
tangentMode: 69
weightedMode: 0
diff --git a/Assets/Scripts/Games/Cannery/Can.cs b/Assets/Scripts/Games/Cannery/Can.cs
index 7f448681d..232ca3f1b 100644
--- a/Assets/Scripts/Games/Cannery/Can.cs
+++ b/Assets/Scripts/Games/Cannery/Can.cs
@@ -1,7 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
-using NaughtyBezierCurves;
using HeavenStudio.Util;
@@ -32,15 +31,17 @@ namespace HeavenStudio.Games.Scripts_Cannery
private void Hit(PlayerActionEvent caller, float state)
{
- game.cannerAnim.DoScaledAnimationAsync("Can", 0.5f);
SoundByte.PlayOneShotGame("cannery/can");
anim.DoScaledAnimationAsync("Can", 0.5f, 0, 1);
- if (state is >= 1 or <= (-1)) {
+ if (state is >= 1 or <= -1) {
SoundByte.PlayOneShot("nearMiss");
+ game.cannerAnim.DoScaledAnimationAsync("CanBarely", 0.5f);
double beat = caller.startBeat + caller.timer;
BeatAction.New(this, new() {
new(beat + 0.35f, () => anim.DoScaledAnimationAsync("Reopen", 0.5f, 0, 1))
});
+ } else {
+ game.cannerAnim.DoScaledAnimationAsync("Can", 0.5f);
}
}
}
diff --git a/Assets/Scripts/Games/Cannery/Cannery.cs b/Assets/Scripts/Games/Cannery/Cannery.cs
index ec640e998..b7f334904 100644
--- a/Assets/Scripts/Games/Cannery/Cannery.cs
+++ b/Assets/Scripts/Games/Cannery/Cannery.cs
@@ -1,9 +1,11 @@
-using HeavenStudio.Util;
-using HeavenStudio.InputSystem;
using System;
using System.Collections.Generic;
+
using UnityEngine;
+using HeavenStudio.Util;
+using HeavenStudio.InputSystem;
+
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
@@ -29,7 +31,7 @@ namespace HeavenStudio.Games.Loaders
new GameAction("can", "Can")
{
preFunction = delegate {
- Cannery.CanSFX(eventCaller.currentEntity.beat);
+ SoundByte.PlayOneShotGame("cannery/ding", eventCaller.currentEntity.beat, forcePlay: true);
if (eventCaller.gameManager.minigameObj.TryGetComponent(out Cannery instance)) {
instance.SendCan(eventCaller.currentEntity.beat);
}
@@ -45,23 +47,6 @@ namespace HeavenStudio.Games.Loaders
},
defaultLength = 0.5f,
},
- new GameAction("backgroundColor", "Background Color")
- {
- function = delegate {
- var e = eventCaller.currentEntity;
- if (eventCaller.gameManager.minigameObj.TryGetComponent(out Cannery instance)) {
- instance.BackgroundColorChange(e.beat, e.length, e["startColor"], e["endColor"], e["ease"]);
- }
- },
- defaultLength = 1f,
- resizable = true,
- parameters = new List()
- {
- new Param("startColor", new Color(1, 1, 1), "Start Color", "Set the color at the start of the event."),
- new Param("endColor", new Color(1, 1, 1), "End Color", "Set the color at the end of the event."),
- new Param("ease", Util.EasingFunction.Ease.Instant, "Ease", "Set the easing of the action."),
- },
- },
new GameAction("alarmColor", "Alarm Color")
{
function = delegate {
@@ -73,8 +58,8 @@ namespace HeavenStudio.Games.Loaders
defaultLength = 0.5f,
parameters = new List()
{
- new Param("startColor", new Color(0.8627f, 0.3725f, 0.0313f), "Start Color", "Set the color at the start of the event.", new() { new((_, _) => true, new string[] { "startColor" }) }),
- new Param("endColor", new Color(0.8627f, 0.3725f, 0.0313f), "End Color", "Set the color at the end of the event."),
+ new Param("startColor", Cannery.alarmColor , "Start Color", "Set the color at the start of the event.", new() { new((_, _) => true, new string[] { "startColor" }) }),
+ new Param("endColor", Cannery.alarmColor, "End Color", "Set the color at the end of the event."),
new Param("ease", Util.EasingFunction.Ease.Instant, "Ease", "Set the easing of the action."),
}
},
@@ -106,29 +91,47 @@ namespace HeavenStudio.Games
public Animator dingAnim;
public Animator cannerAnim;
- private ColorEase bgColorEase = new(Color.white);
- private ColorEase alarmColorEase = new(new Color(0.862f, 0.372f, 0.031f));
+ // private ColorEase bgColorEase = new(Color.white);
+ public static readonly Color alarmColor = new Color(0.8627f, 0.3725f, 0.0313f);
+ public double aStartBeat;
+ public float aLength;
+ public Color aStartColor, aEndColor;
+ public Util.EasingFunction.Ease aEase = Util.EasingFunction.Ease.Instant;
+ public Util.EasingFunction.Function aEaseFunc;
private bool alarmBop = true;
- // public static Cannery instance;
-
private void Awake()
{
- // instance = this;
can.gameObject.SetActive(false);
- // bgColorEase = new(Color.white);
- // alarmColorEase = new(new Color(0.86f, 0.37f, 0.03f));
+ aStartColor = aEndColor = alarmColor;
}
private void Update()
{
- conveyorBeltAnim.DoNormalizedAnimation("Move", (Conductor.instance.songPositionInBeats / 2) % 1);
+ if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) {
+ cannerAnim.DoScaledAnimationAsync("CanEmpty", 0.5f);
+ SoundByte.PlayOneShotGame("cannery/can");
+ SoundByte.PlayOneShot("nearMiss");
+ }
+ conveyorBeltAnim.DoNormalizedAnimation("Move", (conductor.songPositionInBeats / 2) % 1);
- bgPlaneSR.color = GetNewColor(bgColorEase);
- alarmMat.SetColor("_ColorAlpha", GetNewColor(alarmColorEase));
+ float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(conductor.songPositionInBeatsAsDouble, aLength));
+
+ Color newColor = alarmColor;
+ if (!double.IsNaN(normalizedBeat)) {
+ aEaseFunc ??= Util.EasingFunction.GetEasingFunction(aEase);
+ float newR = aEaseFunc(aStartColor.r, aEndColor.r, normalizedBeat);
+ float newG = aEaseFunc(aStartColor.g, aEndColor.g, normalizedBeat);
+ float newB = aEaseFunc(aStartColor.b, aEndColor.b, normalizedBeat);
+ newColor = new Color(newR, newG, newB);
+ }
+
+ alarmMat.SetColor("_ColorAlpha", newColor);
}
+ public override void OnPlay(double beat) => OnGameSwitch(beat);
+ public override void OnStop(double beat) => OnGameSwitch(beat);
public override void OnGameSwitch(double beat)
{
List events = GameManager.instance.Beatmap.Entities.FindAll(e => e.datamodel.Split('/')[0] == "cannery");
@@ -136,27 +139,16 @@ namespace HeavenStudio.Games
foreach (var can in cans) {
SendCan(can.beat);
}
- RiqEntity bgEvent = events.FindLast(e => e.datamodel == "cannery/backgroundColor" && e.beat < beat);
- if (bgEvent != null) {
- var e = bgEvent;
- BackgroundColorChange(e.beat, e.length, e["startColor"], e["endColor"], e["ease"]);
- } else {
- BackgroundColorChange(0, 0, new Color(0.8627f, 0.3725f, 0.0313f), new Color(0.8627f, 0.3725f, 0.0313f), 0);
- }
+
RiqEntity alarmEvent = events.FindLast(e => e.datamodel == "cannery/alarmColor" && e.beat < beat);
if (alarmEvent != null) {
var e = alarmEvent;
- BackgroundColorChange(e.beat, e.length, e["startColor"], e["endColor"], e["ease"]);
+ AlarmColor(e.beat, e.length, e["startColor"], e["endColor"], e["ease"]);
} else {
- BackgroundColorChange(0, 0, Color.white, Color.white, 0);
+ AlarmColor(0, 0, alarmColor, alarmColor, (int)Util.EasingFunction.Ease.Instant);
}
}
- public override void OnPlay(double beat)
- {
- OnGameSwitch(beat);
- }
-
public override void OnLateBeatPulse(double beat)
{
if (alarmBop) {
@@ -178,22 +170,16 @@ namespace HeavenStudio.Games
public void AlarmColor(double beat, float length, Color startColor, Color endColor, int ease)
{
- alarmColorEase = new(beat, length, startColor, endColor, ease);
- }
-
- public void BackgroundColorChange(double beat, float length, Color startColor, Color endColor, int ease)
- {
- bgColorEase = new(beat, length, startColor, endColor, ease);
- }
-
- public static void CanSFX(double beat)
- {
- SoundByte.PlayOneShotGame("cannery/ding", beat);
+ aStartBeat = beat;
+ aLength = length;
+ aStartColor = startColor;
+ aEndColor = endColor;
+ aEase = (Util.EasingFunction.Ease)ease;
+ aEaseFunc = Util.EasingFunction.GetEasingFunction(aEase);
}
public void SendCan(double beat)
{
- Debug.Log(dingAnim);
// do the ding animation on the beat
BeatAction.New(this, new() { new(beat, delegate { dingAnim.DoScaledAnimationAsync("Ding", 0.5f); }) });
diff --git a/Assets/Scripts/Games/Minigame.cs b/Assets/Scripts/Games/Minigame.cs
index ed8d89318..eafdc64ba 100644
--- a/Assets/Scripts/Games/Minigame.cs
+++ b/Assets/Scripts/Games/Minigame.cs
@@ -428,42 +428,6 @@ namespace HeavenStudio.Games
#endregion
- #region Color
- public struct ColorEase
- {
- public double startBeat;
- public float length;
- public Color startColor, endColor;
- public Util.EasingFunction.Ease ease;
- public readonly Util.EasingFunction.Function easeFunc;
- public ColorEase(double startBeat, float length, Color startColor, Color endColor, int ease) {
- this.startBeat = startBeat;
- this.length = length;
- (this.startColor, this.endColor) = (startColor, endColor);
- this.ease = (Util.EasingFunction.Ease)ease;
- this.easeFunc = Util.EasingFunction.GetEasingFunction(this.ease);
- }
- public ColorEase(Color color) {
- startBeat = length = 0;
- startColor = endColor = color;
- this.ease = Util.EasingFunction.Ease.Instant;
- this.easeFunc = Util.EasingFunction.GetEasingFunction(this.ease);
- }
- }
-
- 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 = beat == 0 && 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);
- }
- #endregion
-
private void OnDestroy()
{
foreach (var evt in scheduledInputs)