Fix up the UI + game flow in minigame, should function correctly now

This commit is contained in:
Michal Pikulski
2025-10-24 13:01:19 +02:00
parent 1003c3f6ac
commit 04737ab01b
11 changed files with 919 additions and 1203 deletions

View File

@@ -75,6 +75,135 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &1188952073410115051
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4893439260580271593}
- component: {fileID: 2903185199836080833}
m_Layer: 0
m_Name: TutorialAudio
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4893439260580271593
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1188952073410115051}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -80.867836, y: 74.80073, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3183207532655435649}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &2903185199836080833
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1188952073410115051}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 3533147658878909314, guid: 727a7e4b6df4b0d47897f7d8ee7fa323, type: 2}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 8300000, guid: fca641cdc8dcd074483fad3db1cbe24c, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &1590200553513530823
GameObject:
m_ObjectHideFlags: 0
@@ -242,7 +371,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1831065641766120066
Transform:
m_ObjectHideFlags: 0
@@ -263,7 +392,7 @@ Transform:
- {fileID: 8442487091540635686}
- {fileID: 8879908034887781514}
- {fileID: 2211814522314670326}
m_Father: {fileID: 4592376486413311028}
m_Father: {fileID: 9007881587001685567}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!111 &1617577586792587006
Animation:
@@ -312,7 +441,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &4249054603034392046
Transform:
m_ObjectHideFlags: 0
@@ -330,7 +459,7 @@ Transform:
- {fileID: 3606233682966098341}
- {fileID: 9050619600904836405}
- {fileID: 4757850631734005462}
m_Father: {fileID: 4592376486413311028}
m_Father: {fileID: 9007881587001685567}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!111 &6215866005480392352
Animation:
@@ -393,6 +522,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4592376486413311028}
- {fileID: 4893439260580271593}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4267886887244421663
@@ -407,8 +537,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c0f21d12fb6a50242b483dbdc3a6a1df, type: 3}
m_Name:
m_EditorClassIdentifier: '::'
divingGameManager: {fileID: 0}
playTutorial: 0
playTutorial: 1
tapPrompt: {fileID: 6751368003081662277}
--- !u!1 &3503751741805984614
GameObject:
m_ObjectHideFlags: 0
@@ -443,8 +573,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 13.456177, y: -2.627655}
m_SizeDelta: {x: 1204.5154, y: 802.1875}
m_AnchoredPosition: {x: 22.853088, y: -89.07968}
m_SizeDelta: {x: 1185.7214, y: 975.0914}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3845799704385814770
CanvasRenderer:
@@ -860,6 +990,43 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5541992152058962912
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9007881587001685567}
m_Layer: 5
m_Name: TutorialScreens
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &9007881587001685567
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5541992152058962912}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4249054603034392046}
- {fileID: 1831065641766120066}
m_Father: {fileID: 4592376486413311028}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &6118149484066388440
GameObject:
m_ObjectHideFlags: 0
@@ -894,8 +1061,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 13.456177, y: -2.627655}
m_SizeDelta: {x: 1204.5154, y: 802.1875}
m_AnchoredPosition: {x: 22.853088, y: -89.07971}
m_SizeDelta: {x: 1185.721, y: 975.0914}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4855560808002867609
CanvasRenderer:
@@ -1010,6 +1177,142 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &6751368003081662277
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5554143010115146741}
- component: {fileID: 3254928157304415694}
- component: {fileID: 490204079952288596}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5554143010115146741
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6751368003081662277}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4592376486413311028}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.000015258789, y: -51.398}
m_SizeDelta: {x: 658.8605, y: 102.796875}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3254928157304415694
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6751368003081662277}
m_CullTransparentMesh: 1
--- !u!114 &490204079952288596
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6751368003081662277}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: TAP TO SKIP
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 75
m_fontSizeBase: 75
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &7059429923783536925
GameObject:
m_ObjectHideFlags: 0
@@ -1043,8 +1346,8 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4249054603034392046}
- {fileID: 1831065641766120066}
- {fileID: 9007881587001685567}
- {fileID: 5554143010115146741}
m_Father: {fileID: 3183207532655435649}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -1070,7 +1373,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0

File diff suppressed because one or more lines are too long

View File

@@ -342,16 +342,16 @@ LineRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_Positions:
- {x: -0.15602553, y: 4.0749445, z: 0}
- {x: -0.1566351, y: 3.9736378, z: 0}
- {x: -0.1572447, y: 3.8729858, z: 0}
- {x: -0.15602553, y: 4.074945, z: 0}
- {x: -0.1566351, y: 3.973638, z: 0}
- {x: -0.1572447, y: 3.8729856, z: 0}
- {x: -0.15785426, y: 3.7729874, z: 0}
- {x: -0.15846384, y: 3.6736438, z: 0}
- {x: -0.15907341, y: 3.5749545, z: 0}
- {x: -0.15968299, y: 3.4769197, z: 0}
- {x: -0.16029257, y: 3.379539, z: 0}
- {x: -0.16090216, y: 3.2828128, z: 0}
- {x: -0.16151173, y: 3.186741, z: 0}
- {x: -0.15846384, y: 3.6736436, z: 0}
- {x: -0.15907341, y: 3.574954, z: 0}
- {x: -0.15968299, y: 3.4769192, z: 0}
- {x: -0.16029257, y: 3.3795385, z: 0}
- {x: -0.16090216, y: 3.2828126, z: 0}
- {x: -0.16151173, y: 3.1867409, z: 0}
- {x: -0.16212131, y: 3.0913236, z: 0}
m_Parameters:
serializedVersion: 3
@@ -1149,7 +1149,7 @@ Transform:
m_GameObject: {fileID: 747976396}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 3.1975174, z: 0}
m_LocalPosition: {x: 0, y: 3.197517, z: 0}
m_LocalScale: {x: 0.57574, y: 0.57574, z: 0.57574}
m_ConstrainProportionsScale: 0
m_Children:
@@ -1544,6 +1544,59 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &999630160 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5541992152058962912, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
m_PrefabInstance: {fileID: 8347532583749285323}
m_PrefabAsset: {fileID: 0}
--- !u!114 &999630162
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 999630160}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9e0b24e2f2ad54cc09940c320ed3cf4b, type: 3}
m_Name:
m_EditorClassIdentifier: PixelplacementAssembly::Pixelplacement.StateMachine
defaultState: {fileID: 1211973842}
currentState: {fileID: 0}
_unityEventsFolded: 0
verbose: 1
allowReentry: 0
returnToDefaultOnDisable: 1
OnStateExited:
m_PersistentCalls:
m_Calls: []
OnStateEntered:
m_PersistentCalls:
m_Calls: []
OnFirstStateEntered:
m_PersistentCalls:
m_Calls: []
OnFirstStateExited:
m_PersistentCalls:
m_Calls: []
OnLastStateEntered:
m_PersistentCalls:
m_Calls: []
OnLastStateExited:
m_PersistentCalls:
m_Calls: []
--- !u!114 &999630163
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 999630160}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 55938fb1577dd4ad3af7e994048c86f6, type: 3}
m_Name:
m_EditorClassIdentifier: PixelplacementAssembly::Pixelplacement.Initialization
--- !u!1 &1003335103
GameObject:
m_ObjectHideFlags: 0
@@ -1701,7 +1754,7 @@ LineRenderer:
m_SortingOrder: 0
m_Positions:
- {x: -0.15602553, y: 4.0749445, z: 0}
- {x: -0.11662118, y: 3.8796222, z: 0}
- {x: -0.11662118, y: 3.879622, z: 0}
- {x: -0.07721684, y: 3.7057445, z: 0}
- {x: -0.03781248, y: 3.5533106, z: 0}
- {x: 0.0015918687, y: 3.4223216, z: 0}
@@ -1709,7 +1762,7 @@ LineRenderer:
- {x: 0.08040057, y: 3.2246761, z: 0}
- {x: 0.11980491, y: 3.15802, z: 0}
- {x: 0.15920927, y: 3.1128082, z: 0}
- {x: 0.1986136, y: 3.0890408, z: 0}
- {x: 0.1986136, y: 3.0890405, z: 0}
- {x: 0.23801796, y: 3.0867176, z: 0}
m_Parameters:
serializedVersion: 3
@@ -1971,6 +2024,51 @@ MonoBehaviour:
m_VarianceClampScale: 0.9
m_ContrastAdaptiveSharpening: 0
m_Version: 2
--- !u!1 &1173818904 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6751368003081662277, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
m_PrefabInstance: {fileID: 8347532583749285323}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1173818908
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1173818904}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b75de64fb2fd4ff0b869bf469e2becea, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::UI.BlinkingCanvasGroup
minAlpha: 0
maxAlpha: 1
legDuration: 0.5
startDelay: 0
obeyTimescale: 0
easeCurve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!225 &1173818909
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1173818904}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1 &1211973842 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2271162218602898139, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
m_PrefabInstance: {fileID: 8347532583749285323}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1224833348
GameObject:
m_ObjectHideFlags: 0
@@ -2138,135 +2236,6 @@ Transform:
m_Children: []
m_Father: {fileID: 2106431002}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1363116017
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1363116018}
- component: {fileID: 1363116019}
m_Layer: 0
m_Name: TutorialAudio
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1363116018
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1363116017}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -80.867836, y: 74.80073, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1849171394}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &1363116019
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1363116017}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 3533147658878909314, guid: 727a7e4b6df4b0d47897f7d8ee7fa323, type: 2}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 8300000, guid: fca641cdc8dcd074483fad3db1cbe24c, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &1376741227
GameObject:
m_ObjectHideFlags: 0
@@ -2549,10 +2518,10 @@ LineRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_Positions:
- {x: -0.15602553, y: 4.074945, z: 0}
- {x: -0.18956745, y: 3.8764977, z: 0}
- {x: -0.22310936, y: 3.7000234, z: 0}
- {x: -0.25665125, y: 3.5455208, z: 0}
- {x: -0.15602553, y: 4.0749445, z: 0}
- {x: -0.18956745, y: 3.8764973, z: 0}
- {x: -0.22310936, y: 3.7000232, z: 0}
- {x: -0.25665125, y: 3.5455203, z: 0}
- {x: -0.29019317, y: 3.412991, z: 0}
- {x: -0.32373506, y: 3.3024335, z: 0}
- {x: -0.35727698, y: 3.2138484, z: 0}
@@ -2926,11 +2895,6 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1849171394 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3183207532655435649, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
m_PrefabInstance: {fileID: 8347532583749285323}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1916796529
GameObject:
m_ObjectHideFlags: 0
@@ -3440,25 +3404,24 @@ PrefabInstance:
propertyPath: m_Name
value: Tutorial
objectReference: {fileID: 0}
- target: {fileID: 3332446944854334578, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4267886887244421663, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
propertyPath: playTutorial
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4267886887244421663, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
propertyPath: divingGameManager
value:
objectReference: {fileID: 424805725}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 8086909437439386099, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
- {fileID: 2002496630232568573, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
m_RemovedGameObjects: []
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 3183207532655435649, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 5541992152058962912, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
insertIndex: -1
addedObject: {fileID: 1363116018}
m_AddedComponents: []
addedObject: {fileID: 999630163}
- targetCorrespondingSourceObject: {fileID: 5541992152058962912, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
insertIndex: -1
addedObject: {fileID: 999630162}
- targetCorrespondingSourceObject: {fileID: 6751368003081662277, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
insertIndex: -1
addedObject: {fileID: 1173818909}
- targetCorrespondingSourceObject: {fileID: 6751368003081662277, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
insertIndex: -1
addedObject: {fileID: 1173818908}
m_SourcePrefab: {fileID: 100100000, guid: a4dd78ff48942854ebb4c65025a8dc36, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using Bootstrap;
using Core;
@@ -7,7 +6,6 @@ using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.Playables;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UI.Core;

View File

@@ -9,6 +9,7 @@ using System.Collections;
using System.Collections.Generic;
using Bootstrap;
using UI;
using UI.Core;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Playables;
@@ -117,6 +118,9 @@ namespace Minigames.DivingForPictures
{
Destroy(gameObject);
}
// Ensure any previous run state is reset when this manager awakes
_isGameOver = false;
}
private void OnApplicationQuit()
@@ -457,6 +461,9 @@ namespace Minigames.DivingForPictures
_isSurfacing = true;
// TODO: Call it here?
UIPageController.Instance.HideAllUI();
// 1. Initiate smooth velocity transition to surfacing speed
float targetVelocityFactor = -1.0f * _settings.SurfacingSpeedFactor;
SetVelocityFactor(targetVelocityFactor);
@@ -693,6 +700,7 @@ namespace Minigames.DivingForPictures
UnityAction onDone = null;
onDone = () => { completed = true; giver.OnCompleted.RemoveListener(onDone); };
giver.OnCompleted.AddListener(onDone);
UIPageController.Instance.ShowAllUI();
giver.GiveBoosterPack();
// 2) Wait for it to finish (with a safety timeout in case it's not wired)
@@ -712,7 +720,7 @@ namespace Minigames.DivingForPictures
// 3) Only then show the game over screen
CinematicsManager.Instance.ShowGameOverScreen();
// Final score could be saved to player prefs or other persistence
Logging.Debug($"Final Score: {_playerScore}");
}
@@ -799,40 +807,46 @@ namespace Minigames.DivingForPictures
/// </summary>
public void Pause()
{
// Ignore pause requests once the game has reached Game Over
if (_isGameOver) return;
DoPause();
}
public void DoPause(bool turnOffGameInput = true)
{
// Pause all registered components
foreach (var component in _pausableComponents)
{
component.Pause();
}
// Change input mode to UI when menu is open
if(turnOffGameInput)
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
Logging.Debug($"[DivingGameManager] Game paused. Paused {_pausableComponents.Count} components.");
}
/// <summary>
/// Resume the game and all registered components
/// </summary>
public void DoResume()
{
// Resume all registered components
foreach (var component in _pausableComponents)
{
component.DoResume();
}
// Change input mode to UI when menu is open
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
Logging.Debug($"[DivingGameManager] Game resumed. Resumed {_pausableComponents.Count} components.");
}
}
public void DoPause(bool turnOffGameInput = true)
{
// Ignore pause requests once the game has ended
if (_isGameOver) return;
// Pause all registered components
foreach (var component in _pausableComponents)
{
component.Pause();
}
// Change input mode to UI when menu is open
if(turnOffGameInput)
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
Logging.Debug($"[DivingGameManager] Game paused. Paused {_pausableComponents.Count} components.");
}
/// <summary>
/// Resume the game and all registered components
/// </summary>
public void DoResume()
{
// Ignore resume requests once the game has ended
if (_isGameOver) return;
// Resume all registered components
foreach (var component in _pausableComponents)
{
component.DoResume();
}
// Change input mode to UI when menu is open
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
Logging.Debug($"[DivingGameManager] Game resumed. Resumed {_pausableComponents.Count} components.");
}
#region Photo Sequence Methods

View File

@@ -0,0 +1,112 @@
using Pixelplacement;
using UnityEngine;
namespace UI
{
/// <summary>
/// Adds a CanvasGroup (if missing) and plays a continuous blinking tween on its alpha.
/// Attach to any GameObject to make it pulse/fade in and out.
/// </summary>
[DisallowMultipleComponent]
[RequireComponent(typeof(CanvasGroup))]
public class BlinkingCanvasGroup : MonoBehaviour
{
[Header("Blink Settings")] [Tooltip("Minimum alpha value during blink")] [Range(0f, 1f)]
public float minAlpha;
[Tooltip("Maximum alpha value during blink")] [Range(0f, 1f)]
public float maxAlpha = 1f;
[Tooltip("Duration of one leg (min->max or max->min)")]
public float legDuration = 0.5f;
[Tooltip("Delay before starting the blinking")]
public float startDelay;
[Tooltip("Whether the tween should obey Time.timeScale (false = unscaled)")]
public bool obeyTimescale;
[Tooltip("Optional animation curve for easing. Leave null for default ease in/out.")]
public AnimationCurve easeCurve;
// Internal
private CanvasGroup _canvasGroup;
private Pixelplacement.TweenSystem.TweenBase _activeTween;
void Awake()
{
// Ensure we have a CanvasGroup
_canvasGroup = GetComponent<CanvasGroup>();
if (_canvasGroup == null)
{
_canvasGroup = gameObject.AddComponent<CanvasGroup>();
}
// Ensure starting alpha
_canvasGroup.alpha = minAlpha;
}
void Start()
{
StartBlinking();
}
void OnEnable()
{
// If re-enabled, ensure tween is running
if (_activeTween == null)
StartBlinking();
}
void OnDisable()
{
StopBlinking();
}
void OnDestroy()
{
StopBlinking();
}
/// <summary>
/// Start the continuous blinking tween.
/// </summary>
public void StartBlinking()
{
StopBlinking();
if (_canvasGroup == null) return;
// Use PingPong-like behavior by chaining two opposite legs with LoopType.Loop
// Simpler: Tween.CanvasGroupAlpha has an overload that sets startAlpha then end.
// We'll tween min->max then set LoopType.PingPong if available. The API supports LoopType.PingPong.
// Start from minAlpha to maxAlpha
_canvasGroup.alpha = minAlpha;
// Use the Tween.Value overload for float with obeyTimescale parameter
_activeTween = Tween.Value(minAlpha, maxAlpha, v => _canvasGroup.alpha = v, legDuration, startDelay,
easeCurve ?? Tween.EaseInOut, Tween.LoopType.PingPong, null, null, obeyTimescale);
}
/// <summary>
/// Stops the blinking tween if running.
/// </summary>
public void StopBlinking()
{
if (_activeTween != null)
{
try
{
_activeTween.Cancel();
}
catch
{
// Some versions of the tween API may not expose Cancel; ignore safely.
}
_activeTween = null;
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b75de64fb2fd4ff0b869bf469e2becea
timeCreated: 1761299308

View File

@@ -2,7 +2,6 @@
using Bootstrap;
using Core;
using Data.CardSystem;
using Input;
using Pixelplacement;
using UI.Core;
using UnityEngine;
@@ -33,8 +32,7 @@ namespace UI.CardSystem
public GameObject BackpackIcon => backpackIcon;
private UIPageController PageController => UIPageController.Instance;
private CardSystemManager _cardManager;
private bool _isInitialized = false;
private bool _hasUnseenCards = false;
private bool _hasUnseenCards;
private void Awake()
{
@@ -59,6 +57,13 @@ namespace UI.CardSystem
// Initialize pages and hide them
InitializePages();
// React to global UI hide/show events (top-page only) by toggling this GameObject
if (UIPageController.Instance != null)
{
UIPageController.Instance.OnAllUIHidden += HandleAllUIHidden;
UIPageController.Instance.OnAllUIShown += HandleAllUIShown;
}
}
private void Start()
@@ -77,8 +82,6 @@ namespace UI.CardSystem
// Initialize UI with current values
UpdateBoosterCount(_cardManager.GetBoosterPackCount());
}
_isInitialized = true;
}
private void OnDestroy()
@@ -103,6 +106,13 @@ namespace UI.CardSystem
{
PageController.OnPageChanged -= OnPageChanged;
}
// Unsubscribe from global UI hide/show events
if (UIPageController.Instance != null)
{
UIPageController.Instance.OnAllUIHidden -= HandleAllUIHidden;
UIPageController.Instance.OnAllUIShown -= HandleAllUIShown;
}
}
/// <summary>
@@ -168,6 +178,7 @@ namespace UI.CardSystem
if (newPage == null)
{
ShowOnlyBackpackIcon();
GameManager.Instance.ReleasePause(this);
}
else
{
@@ -221,8 +232,6 @@ namespace UI.CardSystem
boosterNotificationDot.gameObject.SetActive(hasBooters || _hasUnseenCards);
}
}
GameManager.Instance.ReleasePause(this);
}
/// <summary>
@@ -313,5 +322,19 @@ namespace UI.CardSystem
// Just log the upgrade event without showing a notification
Logging.Debug($"[CardAlbumUI] Card upgraded: {card.Name} to {card.Rarity}");
}
// Handlers for UI controller hide/show events — toggle this GameObject active state
private void HandleAllUIHidden()
{
// Ensure UI returns to backpack-only state before deactivating so we don't leave the game paused
ShowOnlyBackpackIcon();
backpackButton.gameObject.SetActive(false);
}
private void HandleAllUIShown()
{
backpackButton.gameObject.SetActive(true);
}
}
}

View File

@@ -23,6 +23,10 @@ namespace UI.Core
// Event fired when the page stack changes
public event Action<UIPage> OnPageChanged;
// Events fired when the controller hides or shows all UI pages
public event Action OnAllUIHidden;
public event Action OnAllUIShown;
private PlayerInput _playerInput;
private InputAction _cancelAction;
@@ -141,5 +145,39 @@ namespace UI.Core
OnPageChanged?.Invoke(null);
Logging.Debug("[UIPageController] Cleared page stack");
}
/// <summary>
/// Hide all currently stacked UI pages by calling TransitionOut on each.
/// This does not modify the page stack; it simply asks pages to transition out
/// so UI elements can be hidden. Subscribers can react to <see cref="OnAllUIHidden"/>.
/// </summary>
public void HideAllUI()
{
// Only transition out the top (active) page — maintains stack semantics.
var current = CurrentPage;
if (current != null)
{
current.TransitionOut();
}
OnAllUIHidden?.Invoke();
}
/// <summary>
/// Show all currently stacked UI pages by calling TransitionIn on each from bottom to top.
/// This does not modify the page stack; it asks pages to transition in so UI elements become visible.
/// Subscribers can react to <see cref="OnAllUIShown"/>.
/// </summary>
public void ShowAllUI()
{
// Only transition in the top (active) page — maintains stack semantics.
var current = CurrentPage;
if (current != null)
{
current.TransitionIn();
}
OnAllUIShown?.Invoke();
}
}
}

View File

@@ -2,7 +2,6 @@ using System;
using Core;
using UnityEngine;
using UnityEngine.SceneManagement;
using Input;
using Bootstrap;
using UI.Core;
using Pixelplacement;
@@ -47,6 +46,13 @@ namespace UI
// Subscribe to scene loaded events
SceneManagerService.Instance.SceneLoadCompleted += SetPauseMenuByLevel;
// Also react to global UI hide/show events from the page controller
if (UIPageController.Instance != null)
{
UIPageController.Instance.OnAllUIHidden += HandleAllUIHidden;
UIPageController.Instance.OnAllUIShown += HandleAllUIShown;
}
// SceneManagerService subscription moved to InitializePostBoot
// Set initial state based on current scene
@@ -62,6 +68,11 @@ namespace UI
{
SceneManagerService.Instance.SceneLoadCompleted -= SetPauseMenuByLevel;
}
if (UIPageController.Instance != null)
{
UIPageController.Instance.OnAllUIHidden -= HandleAllUIHidden;
UIPageController.Instance.OnAllUIShown -= HandleAllUIShown;
}
}
/// <summary>
@@ -132,7 +143,6 @@ namespace UI
pauseMenuPanel.SetActive(false);
if (pauseButton != null)
pauseButton.SetActive(true);
EndPauseSideEffects();
if (canvasGroup != null)
{
canvasGroup.alpha = 0f;
@@ -143,12 +153,18 @@ namespace UI
}
}
public void HidePauseMenuAndResumeGame()
{
HidePauseMenu();
EndPauseSideEffects();
}
/// <summary>
/// Resumes the game by hiding the pause menu.
/// </summary>
public void ResumeGame()
{
HidePauseMenu();
HidePauseMenuAndResumeGame();
}
private void BeginPauseSideEffects()
@@ -253,7 +269,7 @@ namespace UI
public async void LoadLevel(int levelSelection)
{
// Hide the pause menu before loading a new level
HidePauseMenu();
HidePauseMenuAndResumeGame();
// Replace with the actual scene name as set in Build Settings
var progress = new Progress<float>(p => Logging.Debug($"Loading progress: {p * 100:F0}%"));
@@ -270,5 +286,42 @@ namespace UI
break;
}
}
// Handlers for UI controller hide/show events — make these safe with respect to transitions and pause state
private void HandleAllUIHidden()
{
var parent = transform.parent?.gameObject ?? gameObject;
// If we're currently transitioning, wait for the transition out to complete before deactivating
if (_isTransitioning)
{
Action handler = null;
handler = () =>
{
OnTransitionOutCompleted -= handler;
parent.SetActive(false);
};
OnTransitionOutCompleted += handler;
return;
}
// If this page is visible, request a proper hide so transition/out side-effects run (e.g. releasing pause)
if (_isVisible)
{
HidePauseMenu();
return;
}
// Otherwise it's safe to immediately deactivate
parent.SetActive(false);
}
private void HandleAllUIShown()
{
var parent = transform.parent?.gameObject ?? gameObject;
// Just ensure the parent is active. Do not force pause or transitions here.
parent.SetActive(true);
}
}
}

View File

@@ -1,175 +1,205 @@
using System.Collections;
using System.Linq;
using UnityEngine;
using Pixelplacement;
using Minigames.DivingForPictures;
using Bootstrap;
using Core;
using Input;
using UnityEngine.Events;
using Pixelplacement;
using UI.Core;
using UnityEngine;
public class DivingTutorial : MonoBehaviour, ITouchInputConsumer
namespace UI.Tutorial
{
private StateMachine stateMachine;
public DivingGameManager divingGameManager;
public bool playTutorial;
// gating for input until current state's animation finishes first loop
private bool canAcceptInput = false;
private Coroutine waitLoopCoroutine;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
public class DivingTutorial : MonoBehaviour, ITouchInputConsumer
{
if (playTutorial == true)
private StateMachine _stateMachine;
public bool playTutorial;
// gating for input until current state's animation finishes first loop
[SerializeField] private GameObject tapPrompt;
private bool _canAcceptInput;
private Coroutine _waitLoopCoroutine;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
InitializeTutorial();
BootCompletionService.RegisterInitAction(InitializeTutorial);
// Ensure prompt is hidden initially (even before tutorial initialization)
if (tapPrompt != null)
tapPrompt.SetActive(false);
}
else { RemoveTutorial(); }
}
void InitializeTutorial()
{
stateMachine = GetComponentInChildren<StateMachine>();
divingGameManager.Pause();
InputManager.Instance.RegisterOverrideConsumer(this);
stateMachine.OnLastStateExited.AddListener(RemoveTutorial);
// prepare gating for the initial active state
SetupInputGateForCurrentState();
}
void RemoveTutorial()
{
Debug.Log("Remove me!");
if (waitLoopCoroutine != null)
void InitializeTutorial()
{
StopCoroutine(waitLoopCoroutine);
waitLoopCoroutine = null;
}
InputManager.Instance.UnregisterOverrideConsumer(this);
divingGameManager.DoResume();
Destroy(gameObject);
}
public void OnTap(Vector2 position)
{
if (!canAcceptInput) return; // block taps until allowed
// consume this tap and immediately block further taps
canAcceptInput = false;
// move to next state
stateMachine.Next(true);
// after the state changes, set up gating for the new active state's animation
SetupInputGateForCurrentState();
}
public void OnHoldStart(Vector2 position)
{
return;
}
public void OnHoldMove(Vector2 position)
{
return;
}
public void OnHoldEnd(Vector2 position)
{
return;
}
private void SetupInputGateForCurrentState()
{
if (waitLoopCoroutine != null)
{
StopCoroutine(waitLoopCoroutine);
waitLoopCoroutine = null;
}
waitLoopCoroutine = StartCoroutine(WaitForFirstLoopOnActiveState());
}
private IEnumerator WaitForFirstLoopOnActiveState()
{
// wait a frame to ensure StateMachine has activated the correct state GameObject
yield return null;
// find the active child under the StateMachine (the current state)
Transform smTransform = stateMachine != null ? stateMachine.transform : transform;
Transform activeState = null;
for (int i = 0; i < smTransform.childCount; i++)
{
var child = smTransform.GetChild(i);
if (child.gameObject.activeInHierarchy)
if (playTutorial)
{
activeState = child;
break;
// pause the game, hide UI, and register for input overrides
GameManager.Instance.RequestPause(this);
UIPageController.Instance.HideAllUI();
InputManager.Instance.RegisterOverrideConsumer(this);
// Setup references
_stateMachine = GetComponentInChildren<StateMachine>();
_stateMachine.OnLastStateExited.AddListener(RemoveTutorial);
// prepare gating for the initial active state
SetupInputGateForCurrentState();
}
else
{
RemoveTutorial();
}
}
if (activeState == null)
void RemoveTutorial()
{
// if we can't find an active state, fail open: allow input
canAcceptInput = true;
yield break;
}
// look for a legacy Animation component on the active state
var anim = activeState.GetComponent<Animation>();
if (anim == null)
{
// no animation to wait for; allow input immediately
canAcceptInput = true;
yield break;
}
// determine a clip/state to observe
string clipName = anim.clip != null ? anim.clip.name : null;
AnimationState observedState = null;
if (!string.IsNullOrEmpty(clipName))
{
observedState = anim[clipName];
}
else
{
// fallback: take the first enabled state in the Animation
foreach (AnimationState st in anim)
Debug.Log("Remove me!");
if (_waitLoopCoroutine != null)
{
observedState = st;
break;
StopCoroutine(_waitLoopCoroutine);
_waitLoopCoroutine = null;
}
// Unpause, unregister input, and show UI
InputManager.Instance.UnregisterOverrideConsumer(this);
UIPageController.Instance.ShowAllUI();
GameManager.Instance.ReleasePause(this);
// hide prompt if present
if (tapPrompt != null)
tapPrompt.SetActive(false);
Destroy(gameObject);
}
public void OnTap(Vector2 position)
{
if (!_canAcceptInput) return; // block taps until allowed
// consume this tap and immediately block further taps
SetInputEnabled(false);
// move to next state
_stateMachine.Next(true);
// after the state changes, set up gating for the new active state's animation
SetupInputGateForCurrentState();
}
public void OnHoldStart(Vector2 position)
{
}
public void OnHoldMove(Vector2 position)
{
}
public void OnHoldEnd(Vector2 position)
{
}
// centralize enabling/disabling input and the tap prompt
private void SetInputEnabled(bool allow)
{
_canAcceptInput = allow;
if (tapPrompt != null)
{
tapPrompt.SetActive(allow);
}
}
if (observedState == null)
private void SetupInputGateForCurrentState()
{
// nothing to observe; allow input
canAcceptInput = true;
yield break;
if (_waitLoopCoroutine != null)
{
StopCoroutine(_waitLoopCoroutine);
_waitLoopCoroutine = null;
}
_waitLoopCoroutine = StartCoroutine(WaitForFirstLoopOnActiveState());
}
// wait until the animation starts playing the observed clip
float safetyTimer = 0f;
while (anim.isActiveAndEnabled && activeState.gameObject.activeInHierarchy && !anim.IsPlaying(observedState.name) && safetyTimer < 2f)
private IEnumerator WaitForFirstLoopOnActiveState()
{
safetyTimer += Time.deltaTime;
// wait a frame to ensure StateMachine has activated the correct state GameObject
yield return null;
}
// wait until the first loop completes (normalizedTime >= 1)
while (anim.isActiveAndEnabled && activeState.gameObject.activeInHierarchy)
{
// if state changed (not playing anymore), allow input to avoid deadlock
if (!anim.IsPlaying(observedState.name)) break;
if (observedState.normalizedTime >= 1f)
// find the active child under the StateMachine (the current state)
Transform smTransform = _stateMachine != null ? _stateMachine.transform : transform;
Transform activeState = null;
for (int i = 0; i < smTransform.childCount; i++)
{
break;
var child = smTransform.GetChild(i);
if (child.gameObject.activeInHierarchy)
{
activeState = child;
break;
}
}
yield return null;
}
canAcceptInput = true;
waitLoopCoroutine = null;
if (activeState == null)
{
// if we can't find an active state, fail open: allow input
SetInputEnabled(true);
yield break;
}
// look for a legacy Animation component on the active state
var anim = activeState.GetComponent<Animation>();
if (anim == null)
{
// no animation to wait for; allow input immediately
SetInputEnabled(true);
yield break;
}
// determine a clip/state to observe
string clipName = anim.clip != null ? anim.clip.name : null;
AnimationState observedState = null;
if (!string.IsNullOrEmpty(clipName))
{
observedState = anim[clipName];
}
else
{
// fallback: take the first enabled state in the Animation
foreach (AnimationState st in anim)
{
observedState = st;
break;
}
}
if (observedState == null)
{
// nothing to observe; allow input
SetInputEnabled(true);
yield break;
}
// wait until the animation starts playing the observed clip
float safetyTimer = 0f;
while (anim.isActiveAndEnabled && activeState.gameObject.activeInHierarchy && !anim.IsPlaying(observedState.name) && safetyTimer < 2f)
{
safetyTimer += Time.deltaTime;
yield return null;
}
// wait until the first loop completes (normalizedTime >= 1)
while (anim.isActiveAndEnabled && activeState.gameObject.activeInHierarchy)
{
// if state changed (not playing anymore), allow input to avoid deadlock
if (!anim.IsPlaying(observedState.name)) break;
if (observedState.normalizedTime >= 1f)
{
break;
}
yield return null;
}
SetInputEnabled(true);
_waitLoopCoroutine = null;
}
}
}