From 26f8fa52e495c00e65fcb286dcec9d2576cb410a Mon Sep 17 00:00:00 2001 From: minenice55 Date: Thu, 21 Sep 2023 11:00:04 -0400 Subject: [PATCH] coin toss re-toss --- .../Animations/CoinTossController.controller | 58 +- .../CoinToss/Animations/Throw_empty.anim | 510 ++++++++++++++++++ .../CoinToss/Animations/Throw_empty.anim.meta | 8 + Assets/Scripts/Games/CoinToss/CoinToss.cs | 51 +- Assets/Scripts/Games/Minigame.cs | 15 +- 5 files changed, 593 insertions(+), 49 deletions(-) create mode 100644 Assets/Resources/Sprites/Games/CoinToss/Animations/Throw_empty.anim create mode 100644 Assets/Resources/Sprites/Games/CoinToss/Animations/Throw_empty.anim.meta diff --git a/Assets/Resources/Sprites/Games/CoinToss/Animations/CoinTossController.controller b/Assets/Resources/Sprites/Games/CoinToss/Animations/CoinTossController.controller index 06b9e8da1..29159ac46 100644 --- a/Assets/Resources/Sprites/Games/CoinToss/Animations/CoinTossController.controller +++ b/Assets/Resources/Sprites/Games/CoinToss/Animations/CoinTossController.controller @@ -43,13 +43,16 @@ AnimatorStateMachine: m_Position: {x: 300, y: -50, z: 0} - serializedVersion: 1 m_State: {fileID: -1162623208037307785} - m_Position: {x: 440, y: 120, z: 0} + m_Position: {x: 540, y: -120, z: 0} - serializedVersion: 1 m_State: {fileID: -7899941970589434758} - m_Position: {x: 530, y: 20, z: 0} + m_Position: {x: 300, y: -120, z: 0} - serializedVersion: 1 m_State: {fileID: 3911154433124293713} m_Position: {x: 540, y: -50, z: 0} + - serializedVersion: 1 + m_State: {fileID: 5413485298585256804} + m_Position: {x: 540, y: 20, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] @@ -70,8 +73,7 @@ AnimatorState: m_Name: Catch_success m_Speed: 1 m_CycleOffset: 0 - m_Transitions: - - {fileID: 3091446025670089204} + m_Transitions: [] m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -135,28 +137,6 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: ---- !u!1101 &3091446025670089204 -AnimatorStateTransition: - m_ObjectHideFlags: 1 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: - m_Conditions: [] - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 7133985828973644718} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - m_TransitionDuration: 0.24999997 - m_TransitionOffset: 0 - m_ExitTime: 0.9999035 - m_HasExitTime: 1 - m_HasFixedDuration: 1 - m_InterruptionSource: 0 - m_OrderedInterruption: 1 - m_CanTransitionToSelf: 1 --- !u!1102 &3911154433124293713 AnimatorState: serializedVersion: 6 @@ -183,6 +163,32 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1102 &5413485298585256804 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Throw_empty + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 685d134b2d3de58479b44dfdae56572c, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: --- !u!1102 &7133985828973644718 AnimatorState: serializedVersion: 6 diff --git a/Assets/Resources/Sprites/Games/CoinToss/Animations/Throw_empty.anim b/Assets/Resources/Sprites/Games/CoinToss/Animations/Throw_empty.anim new file mode 100644 index 000000000..9c2d9966e --- /dev/null +++ b/Assets/Resources/Sprites/Games/CoinToss/Animations/Throw_empty.anim @@ -0,0 +1,510 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Throw_empty + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0.016666668 + value: {x: -4.52, y: 1.57, z: 0} + inSlope: {x: Infinity, y: Infinity, z: Infinity} + outSlope: {x: Infinity, y: Infinity, z: Infinity} + 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.05 + value: {x: -4.52, y: 1.51, z: 0} + inSlope: {x: Infinity, y: Infinity, z: Infinity} + outSlope: {x: Infinity, y: Infinity, z: Infinity} + 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.083333336 + value: {x: -4.52, y: 1.55, z: 0} + inSlope: {x: Infinity, y: Infinity, z: Infinity} + outSlope: {x: Infinity, y: Infinity, z: Infinity} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: Hand + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0.016666668 + value: {x: 0, y: 0.47, z: 0} + inSlope: {x: Infinity, y: Infinity, z: Infinity} + outSlope: {x: Infinity, y: Infinity, z: Infinity} + 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.05 + value: {x: 0, y: 0.40999994, z: 0} + inSlope: {x: Infinity, y: Infinity, z: Infinity} + outSlope: {x: Infinity, y: Infinity, z: Infinity} + 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.083333336 + value: {x: 0, y: 0.3, z: 0} + inSlope: {x: Infinity, y: Infinity, z: Infinity} + outSlope: {x: Infinity, y: Infinity, z: Infinity} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: Sleeve + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hand/catch + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hand/whoosh + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hand/Coin + classID: 1 + script: {fileID: 0} + m_PPtrCurves: + - curve: + - time: 0.016666668 + value: {fileID: -8498782790087183868, guid: eab6bdf53b08c644db9afb05df441329, type: 3} + - time: 0.083333336 + value: {fileID: 8877829940631261346, guid: eab6bdf53b08c644db9afb05df441329, type: 3} + attribute: m_Sprite + path: Hand + classID: 212 + script: {fileID: 0} + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 2270227889 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 1631782123 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 1792301856 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 403452648 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 1080045770 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 2270227889 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + pptrCurveMapping: + - {fileID: -8498782790087183868, guid: eab6bdf53b08c644db9afb05df441329, type: 3} + - {fileID: 8877829940631261346, guid: eab6bdf53b08c644db9afb05df441329, type: 3} + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0.016666668 + value: -4.52 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: -4.52 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: -4.52 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: Hand + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0.016666668 + value: 1.57 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: 1.51 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 1.55 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: Hand + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0.016666668 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: Hand + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hand/catch + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hand/whoosh + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0.016666668 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: Sleeve + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0.016666668 + value: 0.47 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: 0.40999994 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0.3 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: Sleeve + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0.016666668 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: Sleeve + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hand/Coin + classID: 1 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Resources/Sprites/Games/CoinToss/Animations/Throw_empty.anim.meta b/Assets/Resources/Sprites/Games/CoinToss/Animations/Throw_empty.anim.meta new file mode 100644 index 000000000..7f21b8300 --- /dev/null +++ b/Assets/Resources/Sprites/Games/CoinToss/Animations/Throw_empty.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 685d134b2d3de58479b44dfdae56572c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CoinToss/CoinToss.cs b/Assets/Scripts/Games/CoinToss/CoinToss.cs index d4b697c55..520f4c87c 100644 --- a/Assets/Scripts/Games/CoinToss/CoinToss.cs +++ b/Assets/Scripts/Games/CoinToss/CoinToss.cs @@ -14,8 +14,8 @@ namespace HeavenStudio.Games.Loaders { new GameAction("toss", "Toss Coin") { - function = delegate { CoinToss.instance.TossCoin(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"], eventCaller.currentEntity["toggle"]); }, - defaultLength = 7, + function = delegate { CoinToss.instance.TossCoin(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"], eventCaller.currentEntity["toggle"]); }, + defaultLength = 7, parameters = new List() { new Param("type", CoinToss.CoinVariation.Default, "Variation", "Special Coin Variations"), @@ -26,7 +26,7 @@ namespace HeavenStudio.Games.Loaders { function = delegate { var e = eventCaller.currentEntity; CoinToss.instance.BackgroundColor(e.beat, e.length, e["colorStart"], e["colorEnd"], e["colorStartF"], e["colorEndF"], e["ease"]); }, - resizable = true, + resizable = true, defaultLength = 4f, parameters = new List() { @@ -35,7 +35,7 @@ namespace HeavenStudio.Games.Loaders new Param("colorStartF", CoinToss.defaultBgColor, "FG Start Color", "The starting color in the fade"), new Param("colorEndF", CoinToss.defaultBgColor, "FG End Color", "The ending color in the fade"), new Param("ease", Util.EasingFunction.Ease.Linear, "Ease") - } + } }, //left in for backwards-compatibility, but cannot be placed @@ -51,9 +51,9 @@ namespace HeavenStudio.Games.Loaders hidden = true }, }, - new List() {"ntr", "aim"}, + new List() { "ntr", "aim" }, "ntrcoin", "en", - new List() {} + new List() { } ); } } @@ -70,6 +70,10 @@ namespace HeavenStudio.Games //Though it would need a bit of code rewrite to make it work with multiple coins + public static PlayerInput.InputAction InputAction_TouchFlick = + new("NtrCoinTouchFlick", new int[] { IAEmptyCat, IAFlickCat, IAEmptyCat }, + IA_Empty, IA_TouchFlick, IA_Empty); + public static CoinToss instance { get; set; } private static Color _defaultBgColor; @@ -82,7 +86,7 @@ namespace HeavenStudio.Games } } - + private static Color _defaultFgColor; public static Color defaultFgColor { @@ -129,6 +133,13 @@ namespace HeavenStudio.Games private void Update() { BackgroundColorUpdate(); + + if (coin != null && (!coin.canHit) && PlayerInput.GetIsAction(InputAction_TouchFlick)) + { + coin.CanHit(true); + isThrowing = true; + handAnimator.Play("Throw_empty", 0, 0); + } } public void TossCoin(double beat, int type, bool audienceReacting) @@ -142,11 +153,11 @@ namespace HeavenStudio.Games isThrowing = true; switch (type) - { - case (int) CoinToss.CoinVariation.Cowbell: - //this was intentional. it was to avoid the throw and cowbells to go offbeat. - SoundByte.PlayOneShotGame("coinToss/cowbell1"); - MultiSound.Play(new MultiSound.Sound[] { + { + case (int)CoinVariation.Cowbell: + //this was intentional. it was to avoid the throw and cowbells to go offbeat. + SoundByte.PlayOneShotGame("coinToss/cowbell1"); + MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("coinToss/cowbell2", beat + 1f, offset: 0.01f), new MultiSound.Sound("coinToss/cowbell1", beat + 2f, offset: 0.01f), new MultiSound.Sound("coinToss/cowbell2", beat + 3f, offset: 0.01f), @@ -154,11 +165,11 @@ namespace HeavenStudio.Games new MultiSound.Sound("coinToss/cowbell2", beat + 5f, offset: 0.01f), new MultiSound.Sound("coinToss/cowbell1", beat + 6f, offset: 0.01f), }); - break; - default: - break; - } - + break; + default: + break; + } + this.audienceReacting = audienceReacting; coin = ScheduleInput(beat, 6f, InputAction_BasicPress, CatchSuccess, CatchMiss, CatchEmpty); @@ -183,16 +194,16 @@ namespace HeavenStudio.Games public void CatchSuccess(PlayerActionEvent caller, float state) { SoundByte.PlayOneShotGame("coinToss/catch"); - if(this.audienceReacting) SoundByte.PlayOneShot("applause"); + if (this.audienceReacting) SoundByte.PlayOneShot("applause"); handAnimator.Play("Catch_success", 0, 0); - isThrowing = false; + isThrowing = false; } public void CatchMiss(PlayerActionEvent caller) { SoundByte.PlayOneShot("miss"); - if(this.audienceReacting) SoundByte.PlayOneShot("audience/disappointed"); + if (this.audienceReacting) SoundByte.PlayOneShot("audience/disappointed"); handAnimator.Play("Pickup", 0, 0); isThrowing = false; diff --git a/Assets/Scripts/Games/Minigame.cs b/Assets/Scripts/Games/Minigame.cs index 3f0e23b56..8007a7870 100644 --- a/Assets/Scripts/Games/Minigame.cs +++ b/Assets/Scripts/Games/Minigame.cs @@ -130,10 +130,9 @@ namespace HeavenStudio.Games ) { - GameObject evtObj = new GameObject("ActionEvent" + (startBeat + timer)); - evtObj.AddComponent(); + GameObject evtObj = new("ActionEvent" + (startBeat + timer)); - PlayerActionEvent evt = evtObj.GetComponent(); + PlayerActionEvent evt = evtObj.AddComponent(); evt.startBeat = startBeat; evt.timer = timer; @@ -332,6 +331,11 @@ namespace HeavenStudio.Games return closest; } + public PlayerActionEvent GetClosestScheduledInput(PlayerInput.InputAction action) + { + return GetClosestScheduledInput(action.inputLockCategory); + } + //Hasn't been tested yet. *Should* work. //Can be used to detect if the user is expected to input something now or not //Useful for strict call and responses games like Tambourine @@ -349,6 +353,11 @@ namespace HeavenStudio.Games return input.IsExpectingInputNow(); } + public bool IsExpectingInputNow(PlayerInput.InputAction wantAction) + { + return IsExpectingInputNow(wantAction.inputLockCategory); + } + // now should fix the fast bpm problem public static double NgEarlyTime() {