From d5b800bb5b98c0c604510a6c3cf55205b5928dd7 Mon Sep 17 00:00:00 2001 From: Carson Kompon Date: Sun, 6 Mar 2022 12:34:54 -0500 Subject: [PATCH 1/3] Added Mr. Upbeat fall animation --- Assets/Resources/Games/mrUpbeat.prefab | 167 +++++++++ .../Games/MrUpbeat/Animations/Fall.anim | 334 +++++++++++++++++- .../Games/MrUpbeat/mrupbeat_main.png.meta | 43 +-- Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs | 27 +- Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs | 5 +- 5 files changed, 522 insertions(+), 54 deletions(-) diff --git a/Assets/Resources/Games/mrUpbeat.prefab b/Assets/Resources/Games/mrUpbeat.prefab index 1582b203..a3867d42 100644 --- a/Assets/Resources/Games/mrUpbeat.prefab +++ b/Assets/Resources/Games/mrUpbeat.prefab @@ -102,6 +102,88 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &1456959186295915410 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5608637247423934025} + - component: {fileID: 221372749823643444} + m_Layer: 0 + m_Name: FallSmear + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &5608637247423934025 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1456959186295915410} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.006, y: 0.76, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1584116570229233278} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &221372749823643444 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1456959186295915410} + 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: -4427745735040970447, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.2916667, y: 1.1041666} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &1488695648487991734 GameObject: m_ObjectHideFlags: 0 @@ -318,6 +400,88 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &2958265234527974793 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8709428748473264351} + - component: {fileID: 1940123820260150204} + m_Layer: 0 + m_Name: FallFX + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &8709428748473264351 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2958265234527974793} + m_LocalRotation: {x: 0, y: 0, z: 1, w: 0} + m_LocalPosition: {x: 0.556, y: -0.074, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1584116570229233278} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} +--- !u!212 &1940123820260150204 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2958265234527974793} + 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: 5270992882044302245, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.2916667, y: 1.1041666} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &3862020474253857803 GameObject: m_ObjectHideFlags: 0 @@ -595,6 +759,8 @@ Transform: m_Children: - {fileID: 2124424146951847609} - {fileID: 3332517713256108722} + - {fileID: 5608637247423934025} + - {fileID: 8709428748473264351} m_Father: {fileID: 1584121333826078951} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -783,6 +949,7 @@ MonoBehaviour: metronome: {fileID: 3862020474253857803} man: {fileID: 8160414645038680372} canGo: 0 + beatCount: 0 --- !u!1 &8412912829583803381 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Fall.anim b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Fall.anim index da82216e..5321ce29 100644 --- a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Fall.anim +++ b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Fall.anim @@ -14,24 +14,186 @@ AnimationClip: m_RotationCurves: [] m_CompressedRotationCurves: [] m_EulerCurves: [] - m_PositionCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: -0.09, y: 0.4, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.016666668 + value: {x: -0.09, y: 0.43, z: 0} + inSlope: {x: 0, y: 3.6, z: 0} + outSlope: {x: 0, y: 3.6, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.033333335 + value: {x: -0.03, y: 0.53, z: 0} + inSlope: {x: 0, y: 4.799999, z: 0} + outSlope: {x: 0, y: 4.799999, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.05 + value: {x: -0.03, y: 0.59, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: Head m_ScaleCurves: [] - m_FloatCurves: [] - m_PPtrCurves: [] + m_FloatCurves: + - 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.016666668 + 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: Body/FallSmear + 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.016666668 + 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: Body/FallFX + classID: 1 + script: {fileID: 0} + m_PPtrCurves: + - curve: + - time: 0 + value: {fileID: 910123527689434379, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - time: 0.016666668 + value: {fileID: 7267509016467870925, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - time: 0.033333335 + value: {fileID: -5599596391108488658, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - time: 0.05 + value: {fileID: -3983884386284601651, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + attribute: m_Sprite + path: Body + classID: 212 + script: {fileID: 0} + - curve: + - time: 0 + value: {fileID: 442070513753258848, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - time: 0.05 + value: {fileID: -1641719250182597347, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + attribute: m_Sprite + path: Head + 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: [] - pptrCurveMapping: [] + genericBindings: + - serializedVersion: 2 + path: 130111906 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 4033203276 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 3235357039 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 2073732236 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + - serializedVersion: 2 + path: 130111906 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + pptrCurveMapping: + - {fileID: 910123527689434379, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - {fileID: 7267509016467870925, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - {fileID: -5599596391108488658, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - {fileID: -3983884386284601651, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - {fileID: 442070513753258848, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - {fileID: -1641719250182597347, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} m_AnimationClipSettings: serializedVersion: 2 m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 1 + m_StopTime: 0.06666667 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 @@ -46,7 +208,165 @@ AnimationClip: m_KeepOriginalPositionXZ: 0 m_HeightFromFeet: 0 m_Mirror: 0 - m_EditorCurves: [] + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.09 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.016666668 + value: -0.09 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.033333335 + value: -0.03 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: Head + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.016666668 + value: 0.43 + inSlope: 3.6 + outSlope: 3.6 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.033333335 + value: 0.53 + inSlope: 4.799999 + outSlope: 4.799999 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: 0.59 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: Head + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: Head + 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.016666668 + 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: Body/FallSmear + 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.016666668 + 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: Body/FallFX + classID: 1 + script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Resources/Sprites/Games/MrUpbeat/mrupbeat_main.png.meta b/Assets/Resources/Sprites/Games/MrUpbeat/mrupbeat_main.png.meta index b7897c45..20fa8bba 100644 --- a/Assets/Resources/Sprites/Games/MrUpbeat/mrupbeat_main.png.meta +++ b/Assets/Resources/Sprites/Games/MrUpbeat/mrupbeat_main.png.meta @@ -64,10 +64,10 @@ TextureImporter: second: mrupbeat_fall_2 - first: 213: -1109266650601169752 - second: mrupbeat_fall_3 + second: mrupbeat_fall_2 - first: 213: -3983884386284601651 - second: mrupbeat_fall_4 + second: mrupbeat_fall_3 externalObjects: {} serializedVersion: 11 mipmaps: @@ -521,8 +521,8 @@ TextureImporter: y: 433 width: 110 height: 77 - alignment: 0 - pivot: {x: 0.5, y: 0.5} + alignment: 9 + pivot: {x: 0.23131311, y: 0.2206722} border: {x: 0, y: 0, z: 0, w: 0} outline: [] physicsShape: [] @@ -542,8 +542,8 @@ TextureImporter: y: 361 width: 110 height: 69 - alignment: 0 - pivot: {x: 0.5, y: 0.5} + alignment: 9 + pivot: {x: 0.25480798, y: 0.24740025} border: {x: 0, y: 0, z: 0, w: 0} outline: [] physicsShape: [] @@ -557,35 +557,14 @@ TextureImporter: weights: [] - serializedVersion: 2 name: mrupbeat_fall_2 - rect: - serializedVersion: 2 - x: 1 - y: 289 - width: 110 - height: 69 - alignment: 0 - pivot: {x: 0.5, y: 0.5} - border: {x: 0, y: 0, z: 0, w: 0} - outline: [] - physicsShape: [] - tessellationDetail: 0 - bones: [] - spriteID: e225b6e00cc3a42b0800000000000000 - internalID: -5599596391108488658 - vertices: [] - indices: - edges: [] - weights: [] - - serializedVersion: 2 - name: mrupbeat_fall_3 rect: serializedVersion: 2 x: 1 y: 225 width: 110 height: 61 - alignment: 0 - pivot: {x: 0.5, y: 0.5} + alignment: 9 + pivot: {x: 0.19380306, y: 0.24692748} border: {x: 0, y: 0, z: 0, w: 0} outline: [] physicsShape: [] @@ -598,15 +577,15 @@ TextureImporter: edges: [] weights: [] - serializedVersion: 2 - name: mrupbeat_fall_4 + name: mrupbeat_fall_3 rect: serializedVersion: 2 x: 1 y: 161 width: 110 height: 61 - alignment: 0 - pivot: {x: 0.5, y: 0.5} + alignment: 9 + pivot: {x: 0.1929862, y: 0.21257469} border: {x: 0, y: 0, z: 0, w: 0} outline: [] physicsShape: [] diff --git a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs index 4dea3eda..db3d939f 100644 --- a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs +++ b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs @@ -17,7 +17,7 @@ namespace RhythmHeavenMania.Games.MrUpbeat public GameEvent beat = new GameEvent(); public GameEvent offbeat = new GameEvent(); public bool canGo = false; - private int beatCount = 0; + public int beatCount = 0; public static MrUpbeat instance; @@ -26,13 +26,15 @@ namespace RhythmHeavenMania.Games.MrUpbeat instance = this; } + private void Start() + { + canGo = false; + man.stepTimes = 0; + SetInterval(0); + } + private void Update() { - if (canGo) - metronome.transform.eulerAngles = new Vector3(0, 0, 270 - Mathf.Cos(Mathf.PI * Conductor.instance.songPositionInBeats) * 75); - //else - // metronome.transform.eulerAngles = new Vector3(0, 0, 200); - List gos = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "mrUpbeat/go"); for(int i=0; i Minigame.LateTime()) { - //Fall(); + if ((game.beatCount % 2 == 0 && stepTimes % 2 == 0) || (game.beatCount % 2 == 1 && stepTimes % 2 == 1)) + { + Fall(); + } targetBeat += 100f; return; } From b389cd7589b904938b1040d26a4b56868ae869d8 Mon Sep 17 00:00:00 2001 From: Carson Kompon Date: Sun, 6 Mar 2022 14:37:50 -0500 Subject: [PATCH 2/3] Fully functional and animated Mr. Upbeat --- Assets/Resources/Games/mrUpbeat.prefab | 184 ++++++++++++++++-- .../Games/MrUpbeat/Animations/Fall.anim | 49 ++++- .../Games/MrUpbeat/Animations/Idle.anim | 65 ++++++- .../Games/MrUpbeat/Animations/Step.anim | 63 ++++++ .../Games/MrUpbeat/mrupbeat_main.png.meta | 25 ++- Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs | 47 +++-- Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs | 71 +++---- Assets/Scripts/Games/MrUpbeat/UpbeatStep.cs | 66 +++++++ .../Scripts/Games/MrUpbeat/UpbeatStep.cs.meta | 11 ++ Assets/Scripts/Minigames.cs | 2 +- 10 files changed, 504 insertions(+), 79 deletions(-) create mode 100644 Assets/Scripts/Games/MrUpbeat/UpbeatStep.cs create mode 100644 Assets/Scripts/Games/MrUpbeat/UpbeatStep.cs.meta diff --git a/Assets/Resources/Games/mrUpbeat.prefab b/Assets/Resources/Games/mrUpbeat.prefab index a3867d42..15f17838 100644 --- a/Assets/Resources/Games/mrUpbeat.prefab +++ b/Assets/Resources/Games/mrUpbeat.prefab @@ -646,6 +646,62 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &5666021292044047195 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7622419266367956722} + - component: {fileID: 4157362534770189002} + m_Layer: 0 + m_Name: Beat + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &7622419266367956722 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5666021292044047195} + 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: [] + m_Father: {fileID: 8301537147055126447} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4157362534770189002 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5666021292044047195} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 671722aab5d7ff34da139a076534caf4, type: 3} + m_Name: + m_EditorClassIdentifier: + inList: 0 + lastState: 0 + state: + gameObject: {fileID: 0} + early: 0 + perfect: 0 + late: 0 + createBeat: 0 + eligibleHitsList: [] + aceTimes: 0 + isEligible: 0 + triggersAutoplay: 1 + startBeat: 0 --- !u!1 &6060117916978306099 GameObject: m_ObjectHideFlags: 0 @@ -761,6 +817,7 @@ Transform: - {fileID: 3332517713256108722} - {fileID: 5608637247423934025} - {fileID: 8709428748473264351} + - {fileID: 2744998194819868968} m_Father: {fileID: 1584121333826078951} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -929,6 +986,7 @@ Transform: - {fileID: 8701843541313247389} - {fileID: 7821851253613277009} - {fileID: 862280508089709600} + - {fileID: 8301537147055126447} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -948,6 +1006,7 @@ MonoBehaviour: firstEnable: 0 metronome: {fileID: 3862020474253857803} man: {fileID: 8160414645038680372} + bt: {fileID: 5666021292044047195} canGo: 0 beatCount: 0 --- !u!1 &8412912829583803381 @@ -1078,18 +1137,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e4fa18aec69a2e949a7e2d4e33bdd2b9, type: 3} m_Name: m_EditorClassIdentifier: - inList: 0 - lastState: 0 - state: - gameObject: {fileID: 0} - early: 0 - perfect: 0 - late: 0 - createBeat: 0 - eligibleHitsList: [] - aceTimes: 0 - isEligible: 0 - triggersAutoplay: 1 game: {fileID: 8728962026160321644} animator: {fileID: 2256168985014220240} blipAnimator: {fileID: 1614535701461294964} @@ -1098,6 +1145,88 @@ MonoBehaviour: - {fileID: 2066794384027118212} targetBeat: 0.25 stepTimes: 0 +--- !u!1 &8959999179820051615 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2744998194819868968} + - component: {fileID: 4164580634482561143} + m_Layer: 0 + m_Name: ShadowFall + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &2744998194819868968 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8959999179820051615} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.523, y: 0.016, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1584116570229233278} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &4164580634482561143 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8959999179820051615} + 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: -2 + m_Sprite: {fileID: -5599596391108488658, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1.9583334, y: 1.6041666} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &8963803634876878173 GameObject: m_ObjectHideFlags: 0 @@ -1180,3 +1309,34 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &9090607052953291167 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8301537147055126447} + m_Layer: 0 + m_Name: Beats + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8301537147055126447 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9090607052953291167} + 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: 7622419266367956722} + m_Father: {fileID: 7248900333300803150} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Fall.anim b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Fall.anim index 5321ce29..57c61b70 100644 --- a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Fall.anim +++ b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Fall.anim @@ -116,6 +116,25 @@ AnimationClip: path: Body/FallFX 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 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Body/ShadowFall + classID: 1 + script: {fileID: 0} m_PPtrCurves: - curve: - time: 0 @@ -123,7 +142,7 @@ AnimationClip: - time: 0.016666668 value: {fileID: 7267509016467870925, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - time: 0.033333335 - value: {fileID: -5599596391108488658, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + value: {fileID: 4385344229349358626, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - time: 0.05 value: {fileID: -3983884386284601651, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} attribute: m_Sprite @@ -167,6 +186,13 @@ AnimationClip: typeID: 1 customType: 0 isPPtrCurve: 0 + - serializedVersion: 2 + path: 326924850 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 - serializedVersion: 2 path: 2073732236 attribute: 0 @@ -184,7 +210,7 @@ AnimationClip: pptrCurveMapping: - {fileID: 910123527689434379, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - {fileID: 7267509016467870925, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - - {fileID: -5599596391108488658, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - {fileID: 4385344229349358626, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - {fileID: -3983884386284601651, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - {fileID: 442070513753258848, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - {fileID: -1641719250182597347, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} @@ -367,6 +393,25 @@ AnimationClip: path: Body/FallFX 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 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Body/ShadowFall + classID: 1 + script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Idle.anim b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Idle.anim index 2e6e7c3e..fa78bcd2 100644 --- a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Idle.anim +++ b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Idle.anim @@ -41,7 +41,35 @@ AnimationClip: m_RotationOrder: 4 path: Head m_ScaleCurves: [] - m_FloatCurves: [] + 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 + - serializedVersion: 3 + time: 0.016666668 + 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: Body/ShadowFall + classID: 1 + script: {fileID: 0} m_PPtrCurves: - curve: - time: 0 @@ -57,6 +85,13 @@ AnimationClip: m_Extent: {x: 0, y: 0, z: 0} m_ClipBindingConstant: genericBindings: + - serializedVersion: 2 + path: 326924850 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 - serializedVersion: 2 path: 2073732236 attribute: 0 @@ -178,6 +213,34 @@ AnimationClip: path: Head 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 + - serializedVersion: 3 + time: 0.016666668 + 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: Body/ShadowFall + classID: 1 + script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Step.anim b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Step.anim index e6cf676b..c9709d5e 100644 --- a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Step.anim +++ b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Step.anim @@ -125,6 +125,34 @@ AnimationClip: path: Body/StepSmearFoot 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 + - serializedVersion: 3 + time: 0.050000004 + 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: Body/ShadowFall + classID: 1 + script: {fileID: 0} m_PPtrCurves: - curve: - time: 0 @@ -165,6 +193,13 @@ AnimationClip: typeID: 1 customType: 0 isPPtrCurve: 0 + - serializedVersion: 2 + path: 326924850 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 - serializedVersion: 2 path: 2073732236 attribute: 0 @@ -382,6 +417,34 @@ AnimationClip: path: Body/StepSmearFoot 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 + - serializedVersion: 3 + time: 0.050000004 + 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: Body/ShadowFall + classID: 1 + script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Resources/Sprites/Games/MrUpbeat/mrupbeat_main.png.meta b/Assets/Resources/Sprites/Games/MrUpbeat/mrupbeat_main.png.meta index 20fa8bba..f92edb38 100644 --- a/Assets/Resources/Sprites/Games/MrUpbeat/mrupbeat_main.png.meta +++ b/Assets/Resources/Sprites/Games/MrUpbeat/mrupbeat_main.png.meta @@ -61,10 +61,10 @@ TextureImporter: second: mrupbeat_fall_1 - first: 213: -5599596391108488658 - second: mrupbeat_fall_2 + second: mrupbeat_shadow_fall - first: 213: -1109266650601169752 - second: mrupbeat_fall_2 + second: mrupbeat_shadow_fall - first: 213: -3983884386284601651 second: mrupbeat_fall_3 @@ -597,6 +597,27 @@ TextureImporter: indices: edges: [] weights: [] + - serializedVersion: 2 + name: mrupbeat_shadow_fall + rect: + serializedVersion: 2 + x: 353 + y: 209 + width: 102 + height: 37 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: e225b6e00cc3a42b0800000000000000 + internalID: -5599596391108488658 + vertices: [] + indices: + edges: [] + weights: [] outline: [] physicsShape: [] bones: [] diff --git a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs index db3d939f..7dc05292 100644 --- a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs +++ b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs @@ -13,9 +13,9 @@ namespace RhythmHeavenMania.Games.MrUpbeat [Header("References")] public GameObject metronome; public UpbeatMan man; + public GameObject bt; public GameEvent beat = new GameEvent(); - public GameEvent offbeat = new GameEvent(); public bool canGo = false; public int beatCount = 0; @@ -31,12 +31,14 @@ namespace RhythmHeavenMania.Games.MrUpbeat canGo = false; man.stepTimes = 0; SetInterval(0); + var pos = Conductor.instance.songPositionInBeats; + StartCoroutine(Upbeat(pos - Mathf.Round(pos))); } private void Update() { List gos = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "mrUpbeat/go"); - for(int i=0; i Conductor.instance.songPositionInBeats) { @@ -53,27 +55,24 @@ namespace RhythmHeavenMania.Games.MrUpbeat metronome.transform.eulerAngles = new Vector3(0, 0, 270 - Mathf.Cos(Mathf.PI * Conductor.instance.songPositionInBeats) * 75); } - if (Conductor.instance.ReportBeat(ref beat.lastReportedBeat) && canGo) + if (Conductor.instance.ReportBeat(ref beat.lastReportedBeat)) { - if(beatCount % 2 == 0) - Jukebox.PlayOneShotGame("mrUpbeat/metronomeRight"); - else - Jukebox.PlayOneShotGame("mrUpbeat/metronomeLeft"); + StartCoroutine(Upbeat()); + if (canGo) + { + if (beatCount % 2 == 0) + Jukebox.PlayOneShotGame("mrUpbeat/metronomeRight"); + else + Jukebox.PlayOneShotGame("mrUpbeat/metronomeLeft"); - beatCount++; - } - - if (Conductor.instance.ReportBeat(ref offbeat.lastReportedBeat, 0.25f, true)) - { - man.Blip(); - if(canGo) man.targetBeat = offbeat.lastReportedBeat + 1f; + Beat(Mathf.Round(Conductor.instance.songPositionInBeats)); + } } } public void SetInterval(float beat) { beatCount = 0; - offbeat.startBeat = beat; man.targetBeat = beat + 320f; man.Idle(); } @@ -82,7 +81,23 @@ namespace RhythmHeavenMania.Games.MrUpbeat { beatCount = 0; } - + + public void Beat(float beat) + { + beatCount++; + + GameObject _beat = Instantiate(bt); + _beat.transform.parent = bt.transform.parent; + _beat.SetActive(true); + UpbeatStep s = _beat.GetComponent(); + s.startBeat = beat; + } + + private IEnumerator Upbeat(float offset = 0) + { + yield return new WaitForSeconds(Conductor.instance.secPerBeat * 0.5f - offset); + man.Blip(); + } } } \ No newline at end of file diff --git a/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs b/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs index c1331f63..bc0b537a 100644 --- a/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs +++ b/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs @@ -8,7 +8,7 @@ using RhythmHeavenMania.Util; namespace RhythmHeavenMania.Games.MrUpbeat { - public class UpbeatMan : PlayerActionObject + public class UpbeatMan : MonoBehaviour { [Header("References")] public MrUpbeat game; @@ -19,48 +19,18 @@ namespace RhythmHeavenMania.Games.MrUpbeat public float targetBeat = 0.25f; public int stepTimes = 0; private bool stepped = false; + private bool onGround = false; public GameEvent blip = new GameEvent(); private void Update() { - float normalizedBeat = Conductor.instance.GetPositionFromMargin(targetBeat, 0.5f); - StateCheck(normalizedBeat); - - if(game.canGo && normalizedBeat > Minigame.LateTime()) - { - if ((game.beatCount % 2 == 0 && stepTimes % 2 == 0) || (game.beatCount % 2 == 1 && stepTimes % 2 == 1)) - { - Fall(); - } - targetBeat += 100f; - return; - } - if (PlayerInput.Pressed()) { - if (state.perfect) - { - Step(); - } - else if(state.notPerfect()) - { - Fall(); - } - else - { - Step(); - } + Step(); } } - public override void OnAce() - { - if (!game.canGo) return; - - Step(); - } - public void Idle() { stepTimes = 0; @@ -75,6 +45,29 @@ namespace RhythmHeavenMania.Games.MrUpbeat animator.Play("Step", 0, 0); Jukebox.PlayOneShotGame("mrUpbeat/step"); + onGround = false; + CheckShadows(); + } + + public void Fall() + { + animator.Play("Fall", 0, 0); + Jukebox.PlayOneShot("miss"); + shadows[0].SetActive(false); + shadows[1].SetActive(false); + onGround = true; + } + + public void Blip() + { + Jukebox.PlayOneShotGame("mrUpbeat/blip"); + blipAnimator.Play("Blip", 0, 0); + } + + private void CheckShadows() + { + if (onGround) return; + if (stepTimes % 2 == 1) { shadows[0].SetActive(false); @@ -87,18 +80,6 @@ namespace RhythmHeavenMania.Games.MrUpbeat transform.localScale = new Vector3(1, 1); } } - - public void Fall() - { - animator.Play("Fall", 0, 0); - Jukebox.PlayOneShot("miss"); - } - - public void Blip() - { - Jukebox.PlayOneShotGame("mrUpbeat/blip"); - blipAnimator.Play("Blip", 0, 0); - } } diff --git a/Assets/Scripts/Games/MrUpbeat/UpbeatStep.cs b/Assets/Scripts/Games/MrUpbeat/UpbeatStep.cs new file mode 100644 index 00000000..f0b1d1f0 --- /dev/null +++ b/Assets/Scripts/Games/MrUpbeat/UpbeatStep.cs @@ -0,0 +1,66 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +using Starpelly; + +using RhythmHeavenMania.Util; + +namespace RhythmHeavenMania.Games.MrUpbeat +{ + public class UpbeatStep : PlayerActionObject + { + public float startBeat; + private bool passedFirst = false; + + private void Start() + { + PlayerActionInit(gameObject, startBeat); + } + + public override void OnAce() + { + Hit(true, true); + } + + private void Update() + { + if (Conductor.instance.GetPositionFromBeat(startBeat, 0.35f) >= 1 && !passedFirst) + { + if(MrUpbeat.instance.man.stepTimes % 2 != startBeat % 2) + Hit(false); + passedFirst = true; + } + if (Conductor.instance.GetPositionFromBeat(startBeat, 0.65f) >= 1) + Hit(false); + + float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 0.5f); + StateCheck(normalizedBeat); + + if (PlayerInput.Pressed()) + { + if (state.perfect) + { + Hit(true); + } else if (state.notPerfect()) + { + Hit(false); + } + } + } + + public void Hit(bool hit, bool force = false) + { + if (force) MrUpbeat.instance.man.Step(); + else if (!hit) MrUpbeat.instance.man.Fall(); + + CleanUp(); + } + + public void CleanUp() + { + Destroy(this.gameObject); + } + + } +} \ No newline at end of file diff --git a/Assets/Scripts/Games/MrUpbeat/UpbeatStep.cs.meta b/Assets/Scripts/Games/MrUpbeat/UpbeatStep.cs.meta new file mode 100644 index 00000000..3363988b --- /dev/null +++ b/Assets/Scripts/Games/MrUpbeat/UpbeatStep.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 671722aab5d7ff34da139a076534caf4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 4959dabb..4e261e6a 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -374,7 +374,7 @@ namespace RhythmHeavenMania new GameAction("start interval", delegate { WizardsWaltz.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 4f, true), new GameAction("plant", delegate { WizardsWaltz.instance.SpawnFlower(eventCaller.currentEntity.beat); }, 0.5f, false), }), - new Minigame("mrUpbeat", "Mr. Upbeat \n[WIP don't use]", "FFFFFF", false, false, new List() + new Minigame("mrUpbeat", "Mr. Upbeat", "FFFFFF", false, false, new List() { new GameAction("prepare", delegate { MrUpbeat.instance.SetInterval(eventCaller.currentEntity.beat); }, 0.5f, true), new GameAction("go", delegate { MrUpbeat.instance.Go(eventCaller.currentEntity.beat); }, 4f, true), From 564c8fe0a612cb829eadd2a9337abd6b280e744e Mon Sep 17 00:00:00 2001 From: Carson Kompon Date: Sun, 6 Mar 2022 14:48:39 -0500 Subject: [PATCH 3/3] Added Ding/Applause SFX to Mr. Upbeat --- Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs | 7 +++++++ Assets/Scripts/Minigames.cs | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs index 7dc05292..ac60d8c6 100644 --- a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs +++ b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs @@ -82,6 +82,13 @@ namespace RhythmHeavenMania.Games.MrUpbeat beatCount = 0; } + public void Ding(bool applause) + { + if(applause) + Jukebox.PlayOneShotGame("mrUpbeat/applause"); + else + Jukebox.PlayOneShotGame("mrUpbeat/ding"); + } public void Beat(float beat) { diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 4e261e6a..4c3ed46b 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -378,6 +378,10 @@ namespace RhythmHeavenMania { new GameAction("prepare", delegate { MrUpbeat.instance.SetInterval(eventCaller.currentEntity.beat); }, 0.5f, true), new GameAction("go", delegate { MrUpbeat.instance.Go(eventCaller.currentEntity.beat); }, 4f, true), + new GameAction("ding!", delegate { MrUpbeat.instance.Ding(eventCaller.currentEntity.toggle); }, 0.5f, parameters: new List() + { + new Param("toggle", false, "Applause") + }), }), /*new Minigame("spaceDance", "Space Dance", "B888F8", new List() {