From 4d32560100cd7c24445bc24c105f3e7220b9efbd Mon Sep 17 00:00:00 2001 From: Jenny Crowe Date: Wed, 9 Feb 2022 00:08:22 -0700 Subject: [PATCH 1/2] Tweezers: Added clamp effect to tweezer pluck animation --- Assets/Resources/Games/rhythmTweezers.prefab | 88 ++++++++++++++++++- .../Animations/Tweezers_Pluck.anim | 63 +++++++++++++ 2 files changed, 149 insertions(+), 2 deletions(-) diff --git a/Assets/Resources/Games/rhythmTweezers.prefab b/Assets/Resources/Games/rhythmTweezers.prefab index 0d21825d..670c1d55 100644 --- a/Assets/Resources/Games/rhythmTweezers.prefab +++ b/Assets/Resources/Games/rhythmTweezers.prefab @@ -195,6 +195,88 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &3082739543595333088 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4348353426286950626} + - component: {fileID: 8734625411924137723} + m_Layer: 0 + m_Name: Clamp + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &4348353426286950626 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3082739543595333088} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0, y: -5.6, z: 0} + m_LocalScale: {x: 3.9, y: 3.9, z: 1} + m_Children: [] + m_Father: {fileID: 3942464277001988917} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &8734625411924137723 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3082739543595333088} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + 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: 3 + m_Sprite: {fileID: 7399396556213270179, guid: 8b24cfccb5b27054bbfccc7d7a912b73, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.92, y: 1.24} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &3177931334588542204 GameObject: m_ObjectHideFlags: 0 @@ -335,6 +417,7 @@ Transform: m_Children: - {fileID: 2763505388420312793} - {fileID: 3093870637168933024} + - {fileID: 4348353426286950626} m_Father: {fileID: 5813499711186931250} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: -60} @@ -440,7 +523,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 2 + m_SortingOrder: 3 m_Sprite: {fileID: 949200655566714557, guid: 8b24cfccb5b27054bbfccc7d7a912b73, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 @@ -907,6 +990,7 @@ MonoBehaviour: EligibleHits: [] firstEnable: 0 Vegetable: {fileID: 3177931334588542204} + VegetableAnimator: {fileID: 0} Tweezers: {fileID: 3391455012319192365} HairsHolder: {fileID: 2002856028339003249} tweezersBeatOffset: 2 @@ -1230,7 +1314,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 100 - m_Sprite: {fileID: 21300000, guid: 2723b94c2b1ab8e44898a44a546f7ceb, type: 3} + m_Sprite: {fileID: 21300000, guid: e465c09ac032ad14ba3010212810392c, type: 3} m_Color: {r: 0, g: 0.58743, b: 1, a: 0.36078432} m_FlipX: 0 m_FlipY: 0 diff --git a/Assets/Resources/Sprites/Games/RhythmTweezers/Animations/Tweezers_Pluck.anim b/Assets/Resources/Sprites/Games/RhythmTweezers/Animations/Tweezers_Pluck.anim index a498d4e7..b4f85b29 100644 --- a/Assets/Resources/Sprites/Games/RhythmTweezers/Animations/Tweezers_Pluck.anim +++ b/Assets/Resources/Sprites/Games/RhythmTweezers/Animations/Tweezers_Pluck.anim @@ -86,6 +86,34 @@ AnimationClip: path: Zoom classID: 1 script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.05 + 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: Clamp + classID: 1 + script: {fileID: 0} m_PPtrCurves: - curve: - time: 0 @@ -117,6 +145,13 @@ AnimationClip: typeID: 1 customType: 0 isPPtrCurve: 0 + - serializedVersion: 2 + path: 1640126718 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 - serializedVersion: 2 path: 183621861 attribute: 0 @@ -324,6 +359,34 @@ AnimationClip: path: Zoom classID: 4 script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.05 + 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: Clamp + classID: 1 + script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 From 9f7197152a3de6be015dd54ed4a072d2f83aa5f5 Mon Sep 17 00:00:00 2001 From: Jenny Crowe Date: Wed, 9 Feb 2022 03:29:09 -0700 Subject: [PATCH 2/2] Tweezers: Functioning gameplay loop + Editor implementation. --- Assets/Resources/Games/rhythmTweezers.prefab | 630 +++++++++++++++++- .../Animations/Vegetable/Vegetable.controller | 25 +- .../Games/RhythmTweezers/References.meta | 8 + .../{ => References}/Guide.png.meta | 0 .../{ => References}/Guide1.png.meta | 0 .../{ => References}/Guide2.png.meta | 0 .../{ => References}/Guide3.png.meta | 0 .../RhythmTweezers/References/Guide4.png.meta | 96 +++ Assets/Scripts/Games/RhythmTweezers/Hair.cs | 6 +- .../Games/RhythmTweezers/RhythmTweezers.cs | 130 +++- .../Scripts/Games/RhythmTweezers/Tweezers.cs | 10 +- Assets/Scripts/Minigames.cs | 9 +- 12 files changed, 874 insertions(+), 40 deletions(-) create mode 100644 Assets/Resources/Sprites/Games/RhythmTweezers/References.meta rename Assets/Resources/Sprites/Games/RhythmTweezers/{ => References}/Guide.png.meta (100%) rename Assets/Resources/Sprites/Games/RhythmTweezers/{ => References}/Guide1.png.meta (100%) rename Assets/Resources/Sprites/Games/RhythmTweezers/{ => References}/Guide2.png.meta (100%) rename Assets/Resources/Sprites/Games/RhythmTweezers/{ => References}/Guide3.png.meta (100%) create mode 100644 Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide4.png.meta diff --git a/Assets/Resources/Games/rhythmTweezers.prefab b/Assets/Resources/Games/rhythmTweezers.prefab index 670c1d55..e7a9ce77 100644 --- a/Assets/Resources/Games/rhythmTweezers.prefab +++ b/Assets/Resources/Games/rhythmTweezers.prefab @@ -1,5 +1,169 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &300770731161108432 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1068057833613208623} + - component: {fileID: 4373396913594735275} + m_Layer: 0 + m_Name: Nose + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1068057833613208623 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 300770731161108432} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0.025, z: 0} + m_LocalScale: {x: 0.78, y: 0.78, z: 1} + m_Children: [] + m_Father: {fileID: 7193044971820823585} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &4373396913594735275 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 300770731161108432} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + 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: 1 + m_Sprite: {fileID: -2904130086847097766, guid: bb906660940d6854a9688fa29ee3320f, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.92, y: 0.92} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &902222063864193436 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6226512453236459454} + - component: {fileID: 1307903343854575920} + m_Layer: 0 + m_Name: Eye_Left + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6226512453236459454 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902222063864193436} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.535, y: 0.4, z: 0} + m_LocalScale: {x: -1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7193044971820823585} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1307903343854575920 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902222063864193436} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + 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: 1 + m_Sprite: {fileID: 307920376999289829, guid: bb906660940d6854a9688fa29ee3320f, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.92, y: 0.92} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &2002856028339003249 GameObject: m_ObjectHideFlags: 0 @@ -302,7 +466,7 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3177931334588542204} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 2.68, z: 0} m_LocalScale: {x: 4.2, y: 4.2, z: 4.2} m_Children: @@ -313,7 +477,7 @@ Transform: - {fileID: 8812709733616465685} - {fileID: 3938391035996190295} - {fileID: 6879237219359362440} - m_Father: {fileID: 5813499711186931250} + m_Father: {fileID: 2852202173104472746} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!212 &6331401567023014501 @@ -386,6 +550,170 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &3377502766692825364 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4456784854969573225} + - component: {fileID: 4368596209713301186} + m_Layer: 0 + m_Name: Stache_Left + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4456784854969573225 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3377502766692825364} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.635, y: -0.15, z: 0} + m_LocalScale: {x: -0.78, y: 0.78, z: 1} + m_Children: [] + m_Father: {fileID: 7193044971820823585} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &4368596209713301186 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3377502766692825364} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + 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: 1 + m_Sprite: {fileID: 8417594603833463690, guid: bb906660940d6854a9688fa29ee3320f, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.92, y: 0.92} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &3408375032701308831 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1413573573330694987} + - component: {fileID: 2746423023479453275} + m_Layer: 0 + m_Name: Mouth + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1413573573330694987 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3408375032701308831} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.42, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7193044971820823585} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &2746423023479453275 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3408375032701308831} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + 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: 1 + m_Sprite: {fileID: 115328013575038345, guid: bb906660940d6854a9688fa29ee3320f, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.92, y: 0.92} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &3684904985109994079 GameObject: m_ObjectHideFlags: 0 @@ -775,6 +1103,88 @@ MonoBehaviour: eligibleHitsList: [] aceTimes: 0 createBeat: 0 +--- !u!1 &4779801656278380537 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2028814728392102610} + - component: {fileID: 8681571750292172627} + m_Layer: 0 + m_Name: Stache_Right + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2028814728392102610 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4779801656278380537} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.635, y: -0.15, z: 0} + m_LocalScale: {x: 0.78, y: 0.78, z: 1} + m_Children: [] + m_Father: {fileID: 7193044971820823585} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &8681571750292172627 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4779801656278380537} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + 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: 1 + m_Sprite: {fileID: 8417594603833463690, guid: bb906660940d6854a9688fa29ee3320f, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.92, y: 0.92} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &5285659482387172336 GameObject: m_ObjectHideFlags: 0 @@ -967,7 +1377,7 @@ Transform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 1118188506360081759} + - {fileID: 2852202173104472746} - {fileID: 3942464277001988917} - {fileID: 5813499711658895220} - {fileID: 6940817485402149263} @@ -989,14 +1399,14 @@ MonoBehaviour: m_EditorClassIdentifier: EligibleHits: [] firstEnable: 0 + VegetableHolder: {fileID: 2852202173104472746} Vegetable: {fileID: 3177931334588542204} - VegetableAnimator: {fileID: 0} + VegetableAnimator: {fileID: 3603513546661280919} Tweezers: {fileID: 3391455012319192365} + hairBase: {fileID: 4104508031135416673} HairsHolder: {fileID: 2002856028339003249} - tweezersBeatOffset: 2 - tweezersRotOffset: {x: -202, y: 180} - rotSpd: 10.5 - offset: 59 + beatInterval: 4 + tweezerBeatOffset: 0 --- !u!1 &5813499711658895222 GameObject: m_ObjectHideFlags: 0 @@ -1079,6 +1489,38 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &5972653925803972848 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2852202173104472746} + m_Layer: 0 + m_Name: VegetableHolder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2852202173104472746 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5972653925803972848} + 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_Children: + - {fileID: 1118188506360081759} + - {fileID: 7193044971820823585} + m_Father: {fileID: 5813499711186931250} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &7069042066287342983 GameObject: m_ObjectHideFlags: 0 @@ -1314,7 +1756,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 100 - m_Sprite: {fileID: 21300000, guid: e465c09ac032ad14ba3010212810392c, type: 3} + m_Sprite: {fileID: 21300000, guid: 196a4cec9936ec146a4581839cfc99f8, type: 3} m_Color: {r: 0, g: 0.58743, b: 1, a: 0.36078432} m_FlipX: 0 m_FlipY: 0 @@ -1325,6 +1767,94 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &8120557903780212462 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7193044971820823585} + - component: {fileID: 9096051369561297840} + m_Layer: 0 + m_Name: VegetableDuplicate + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7193044971820823585 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8120557903780212462} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 16.7, y: 2.68, z: 0} + m_LocalScale: {x: 4.2, y: 4.2, z: 4.2} + m_Children: + - {fileID: 6226512453236459454} + - {fileID: 5361624405334515297} + - {fileID: 1068057833613208623} + - {fileID: 2028814728392102610} + - {fileID: 4456784854969573225} + - {fileID: 1413573573330694987} + m_Father: {fileID: 2852202173104472746} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &9096051369561297840 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8120557903780212462} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + 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: 0 + m_Sprite: {fileID: 848710030467426981, guid: 27e9694e644a6914d9047c1029955365, type: 3} + m_Color: {r: 0.8679245, g: 0.6164698, b: 0, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.68, y: 3.32} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &8626470253387948976 GameObject: m_ObjectHideFlags: 0 @@ -1407,3 +1937,85 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &8946559871729365377 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5361624405334515297} + - component: {fileID: 7714950059230223278} + m_Layer: 0 + m_Name: Eye_Right + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5361624405334515297 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8946559871729365377} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.535, y: 0.4, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7193044971820823585} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &7714950059230223278 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8946559871729365377} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + 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: 1 + m_Sprite: {fileID: 307920376999289829, guid: bb906660940d6854a9688fa29ee3320f, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.92, y: 0.92} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 diff --git a/Assets/Resources/Sprites/Games/RhythmTweezers/Animations/Vegetable/Vegetable.controller b/Assets/Resources/Sprites/Games/RhythmTweezers/Animations/Vegetable/Vegetable.controller index 983d85f7..d6fc82fa 100644 --- a/Assets/Resources/Sprites/Games/RhythmTweezers/Animations/Vegetable/Vegetable.controller +++ b/Assets/Resources/Sprites/Games/RhythmTweezers/Animations/Vegetable/Vegetable.controller @@ -26,6 +26,28 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1101 &-4419592797222438125 +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: -8842574261698634582} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1102 &-2331805597223418774 AnimatorState: serializedVersion: 6 @@ -115,7 +137,8 @@ AnimatorState: m_Name: HopFinal m_Speed: 1 m_CycleOffset: 0 - m_Transitions: [] + m_Transitions: + - {fileID: -4419592797222438125} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 diff --git a/Assets/Resources/Sprites/Games/RhythmTweezers/References.meta b/Assets/Resources/Sprites/Games/RhythmTweezers/References.meta new file mode 100644 index 00000000..042e4045 --- /dev/null +++ b/Assets/Resources/Sprites/Games/RhythmTweezers/References.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b76a91a2e00e0da449336c34c0ad5b1e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Sprites/Games/RhythmTweezers/Guide.png.meta b/Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide.png.meta similarity index 100% rename from Assets/Resources/Sprites/Games/RhythmTweezers/Guide.png.meta rename to Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide.png.meta diff --git a/Assets/Resources/Sprites/Games/RhythmTweezers/Guide1.png.meta b/Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide1.png.meta similarity index 100% rename from Assets/Resources/Sprites/Games/RhythmTweezers/Guide1.png.meta rename to Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide1.png.meta diff --git a/Assets/Resources/Sprites/Games/RhythmTweezers/Guide2.png.meta b/Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide2.png.meta similarity index 100% rename from Assets/Resources/Sprites/Games/RhythmTweezers/Guide2.png.meta rename to Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide2.png.meta diff --git a/Assets/Resources/Sprites/Games/RhythmTweezers/Guide3.png.meta b/Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide3.png.meta similarity index 100% rename from Assets/Resources/Sprites/Games/RhythmTweezers/Guide3.png.meta rename to Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide3.png.meta diff --git a/Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide4.png.meta b/Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide4.png.meta new file mode 100644 index 00000000..0175d8d0 --- /dev/null +++ b/Assets/Resources/Sprites/Games/RhythmTweezers/References/Guide4.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 196a4cec9936ec146a4581839cfc99f8 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + 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 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + 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: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/RhythmTweezers/Hair.cs b/Assets/Scripts/Games/RhythmTweezers/Hair.cs index 0021dd08..de8ea3c6 100644 --- a/Assets/Scripts/Games/RhythmTweezers/Hair.cs +++ b/Assets/Scripts/Games/RhythmTweezers/Hair.cs @@ -7,16 +7,18 @@ namespace RhythmHeavenMania.Games.RhythmTweezers public class Hair : PlayerActionObject { public float createBeat; + private RhythmTweezers game; private Tweezers tweezers; private void Awake() { - tweezers = RhythmTweezers.instance.Tweezers; + game = RhythmTweezers.instance; + tweezers = game.Tweezers; } private void Update() { - float stateBeat = Conductor.instance.GetPositionFromBeat(createBeat, 4f); + float stateBeat = Conductor.instance.GetPositionFromBeat(createBeat + game.tweezerBeatOffset, game.beatInterval); StateCheck(stateBeat); if (PlayerInput.Pressed() && tweezers.hitOnFrame == 0) diff --git a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs index d5998e35..444c1cd9 100644 --- a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs +++ b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs @@ -1,6 +1,9 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using System; +using Starpelly; +using DG.Tweening; using RhythmHeavenMania.Util; @@ -9,16 +12,22 @@ namespace RhythmHeavenMania.Games.RhythmTweezers // use PlayerActionObject for the actual tweezers but this isn't playable rn so IDC public class RhythmTweezers : Minigame { + public Transform VegetableHolder; public GameObject Vegetable; public Animator VegetableAnimator; public Tweezers Tweezers; + public GameObject hairBase; [SerializeField] private GameObject HairsHolder; + [NonSerialized] public int hairsLeft = 0; - public float tweezersBeatOffset; - public Vector2 tweezersRotOffset; - public float rotSpd; - public float offset; + public float beatInterval = 4f; + float intervalStartBeat; + bool intervalStarted; + public float tweezerBeatOffset = 0f; + + Tween transitionTween; + bool transitioning = false; public static RhythmTweezers instance { get; set; } @@ -27,39 +36,108 @@ namespace RhythmHeavenMania.Games.RhythmTweezers instance = this; } - private void Start() + public void SpawnHair(float beat) { - float beat = 0; - float offset = 0f; - BeatAction.New(HairsHolder, new List() + // End transition early if the next hair is a lil early. + StopTransitionIfActive(); + + // If interval hasn't started, assume this is the first hair of the interval. + if (!intervalStarted) { - new BeatAction.Action(beat + offset, delegate { SpawnHair(beat + offset); }), - new BeatAction.Action(beat + 1f + offset, delegate { SpawnHair(beat + 1f + offset); }), - new BeatAction.Action(beat + 2f + offset, delegate - { - SpawnHair(beat + 2f + offset); - }), - new BeatAction.Action(beat + 3f + offset, delegate { SpawnHair(beat + 3f + offset); }), - }); + SetIntervalStart(beat, beatInterval); + } + + Jukebox.PlayOneShotGame("rhythmTweezers/shortAppear", beat); + Hair hair = Instantiate(hairBase, HairsHolder.transform).GetComponent(); + hair.gameObject.SetActive(true); + + float rot = -58f + 116 * Mathp.Normalize(beat, intervalStartBeat, intervalStartBeat + beatInterval - 1f); + hair.transform.eulerAngles = new Vector3(0, 0, rot); + hair.createBeat = beat; + hairsLeft++; } - private void SpawnHair(float beat) + public void SetIntervalStart(float beat, float interval = 4f) { - Jukebox.PlayOneShotGame("rhythmTweezers/shortAppear", beat); - GameObject hair = Instantiate(HairsHolder.transform.GetChild(0).gameObject, HairsHolder.transform); - hair.SetActive(true); + // End transition early if the interval starts a lil early. + StopTransitionIfActive(); - float rot = ((offset / 3f) * (beat * 2f)) - offset; + intervalStartBeat = beat; + beatInterval = interval; + intervalStarted = true; + hairsLeft = 0; + } - hair.transform.eulerAngles = new Vector3(0, 0, rot); - hair.GetComponent().createBeat = beat; + const float vegDupeOffset = 16.7f; + public void NextVegetable(float beat) + { + transitioning = true; + + Jukebox.PlayOneShotGame("rhythmTweezers/register", beat); + + // Move both vegetables to the left by vegDupeOffset, then reset their positions. + // On position reset, reset state of core vegetable. + transitionTween = VegetableHolder.DOLocalMoveX(-vegDupeOffset, Conductor.instance.secPerBeat * 0.5f) + .OnComplete(() => { + + var holderPos = VegetableHolder.localPosition; + VegetableHolder.localPosition = new Vector3(0f, holderPos.y, holderPos.z); + + ResetVegetable(); + transitioning = false; + intervalStarted = false; + + }).SetEase(Ease.InOutSine); } private void Update() { - float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(tweezersBeatOffset, rotSpd); - float rot = Mathf.Lerp(tweezersRotOffset.x, tweezersRotOffset.y, normalizedBeat); - Tweezers.transform.eulerAngles = new Vector3(0, 0, rot); + if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused && intervalStarted) + { + StopTransitionIfActive(); + ResetVegetable(); + intervalStarted = false; + } + } + + private void LateUpdate() + { + // Set tweezer angle. + var tweezerAngle = -180f; + + if (intervalStarted) + { + var tweezerTime = Conductor.instance.songPositionInBeats - beatInterval - tweezerBeatOffset; + var unclampedAngle = -58f + 116 * Mathp.Normalize(tweezerTime, intervalStartBeat, intervalStartBeat + beatInterval - 1f); + tweezerAngle = Mathf.Clamp(unclampedAngle, -180f, 180f); + } + + Tweezers.transform.eulerAngles = new Vector3(0, 0, tweezerAngle); + + // Set tweezer to follow vegetable. + var currentTweezerPos = Tweezers.transform.localPosition; + Tweezers.transform.localPosition = new Vector3(currentTweezerPos.x, Vegetable.transform.localPosition.y + 1f, currentTweezerPos.z); + } + + private void ResetVegetable() + { + foreach (Transform t in HairsHolder.transform) + { + var go = t.gameObject; + if (go != hairBase) + GameObject.Destroy(go); + } + + VegetableAnimator.Play("Idle", 0, 0); + } + + private void StopTransitionIfActive() + { + if (transitioning) + { + if (transitionTween != null) + transitionTween.Kill(true); + } } } } diff --git a/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs b/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs index f4a49c0e..7b3259e9 100644 --- a/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs +++ b/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs @@ -35,9 +35,17 @@ namespace RhythmHeavenMania.Games.RhythmTweezers if (ace) { - RhythmTweezers.instance.Vegetable.GetComponent().Play("Hop", 0, 0); + var game = RhythmTweezers.instance; + Jukebox.PlayOneShotGame($"rhythmTweezers/shortPluck{Random.Range(1, 21)}"); Destroy(hair.gameObject); + + game.hairsLeft--; + + if (game.hairsLeft <= 0) + vegetableAnim.Play("HopFinal", 0, 0); + else + vegetableAnim.Play("Hop", 0, 0); } } } diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index d49fa25a..65b77250 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -10,6 +10,7 @@ using RhythmHeavenMania.Games.Spaceball; using RhythmHeavenMania.Games.KarateMan; using RhythmHeavenMania.Games.SpaceSoccer; using RhythmHeavenMania.Games.DJSchool; +using RhythmHeavenMania.Games.RhythmTweezers; namespace RhythmHeavenMania { @@ -187,9 +188,15 @@ namespace RhythmHeavenMania new GameAction("break c'mon ooh", delegate { DJSchool.instance.BreakCmon(eventCaller.currentEntity.beat); }, 3f), new GameAction("scratch-o hey", delegate { DJSchool.instance.ScratchoHey(eventCaller.currentEntity.beat); }, 3f), }), - /*new Minigame("rhythmTweezers", "VeggieTales", "008c97", false, false, new List() + new Minigame("rhythmTweezers", "Rhythm Tweezers \n[WIP don't use]", "98b389", false, false, new List() { + new GameAction("start interval", delegate { RhythmTweezers.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 4f, true), + new GameAction("short hair", delegate { RhythmTweezers.instance.SpawnHair(eventCaller.currentEntity.beat); }, 0.5f), + new GameAction("next vegetable", delegate { RhythmTweezers.instance.NextVegetable(eventCaller.currentEntity.beat); }, 0.5f), + new GameAction("set tweezer delay", delegate { RhythmTweezers.instance.tweezerBeatOffset = eventCaller.currentEntity.length; }, 1f, true), + new GameAction("reset tweezer delay", delegate { RhythmTweezers.instance.tweezerBeatOffset = 0f; }, 0.5f), }), + /* new Minigame("rhythmRally", "Rhythm Rally", "B888F8", true, false, new List() {