From 859e719e3c6d488321f6b01331c4fc7c589bbca3 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Thu, 28 Jul 2022 19:12:21 -0400 Subject: [PATCH] start working on inputs - InputType enum is now flags, can be combined together --- Assets/Resources/Games/karateManNew.prefab | 557 +++++------------- .../Games/KarateMan/anime/karateman/Beat.anim | 2 +- .../Games/KarateMan/anime/karateman/Jab.anim | 2 +- .../KarateMan/anime/karateman/ManCharge.anim | 2 +- .../KarateMan/anime/karateman/ManKick.anim | 2 +- .../KarateMan/anime/karateman/NoPose.anim | 2 +- .../KarateMan/anime/karateman/Straight.anim | 2 +- .../Games/KarateMan/KarateManJoeNew.cs | 81 +++ .../Games/KarateMan/KarateManJoeNew.cs.meta | 11 + .../Scripts/Games/KarateMan/KarateManNew.cs | 79 ++- .../Games/KarateMan/KarateManPotNew.cs | 160 ++++- Assets/Scripts/Games/PlayerActionEvent.cs | 28 +- Assets/Scripts/InputType.cs | 29 +- 13 files changed, 491 insertions(+), 466 deletions(-) create mode 100644 Assets/Scripts/Games/KarateMan/KarateManJoeNew.cs create mode 100644 Assets/Scripts/Games/KarateMan/KarateManJoeNew.cs.meta diff --git a/Assets/Resources/Games/karateManNew.prefab b/Assets/Resources/Games/karateManNew.prefab index cc3745fd..9706b931 100644 --- a/Assets/Resources/Games/karateManNew.prefab +++ b/Assets/Resources/Games/karateManNew.prefab @@ -123,6 +123,7 @@ GameObject: - component: {fileID: 3200089345939772346} - component: {fileID: 5835591724531542630} - component: {fileID: 3234329793564267697} + - component: {fileID: 5897754239051819249} m_Layer: 0 m_Name: KarateMan m_TagString: Untagged @@ -183,6 +184,19 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &5897754239051819249 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616492206260782460} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e6ef00cb3bdcfd647bd634066ce4107d, type: 3} + m_Name: + m_EditorClassIdentifier: + anim: {fileID: 3234329793564267697} --- !u!1 &676219503303960657 GameObject: m_ObjectHideFlags: 0 @@ -255,7 +269,7 @@ SpriteRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_Sprite: {fileID: 8050164209934277894, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 1, g: 0, b: 0, a: 0.5176471} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 @@ -485,7 +499,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1089457186893806244} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -0.5, z: -10} + m_LocalPosition: {x: 0, y: -0.6, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 769274001585151052} @@ -645,7 +659,7 @@ SpriteRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_Sprite: {fileID: 8050164209934277894, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 1, g: 0, b: 0, a: 0.5176471} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 @@ -985,6 +999,88 @@ SpriteRenderer: m_WasSpriteAssigned: 0 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &2136808730019920255 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4580764379744752145} + - component: {fileID: 5778797993957912784} + m_Layer: 0 + m_Name: ItemShadow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &4580764379744752145 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2136808730019920255} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.64, y: 0.64, z: 1} + m_Children: [] + m_Father: {fileID: 3325930061220206449} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &5778797993957912784 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2136808730019920255} + 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: -270761472599659251, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 3.8888888, y: 3} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &2185108278542468920 GameObject: m_ObjectHideFlags: 0 @@ -1226,7 +1322,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 4.7777777, y: 6.5555553} + m_Size: {x: 4.0277777, y: 6.111111} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 @@ -1560,100 +1656,6 @@ SpriteRenderer: m_WasSpriteAssigned: 0 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &2666246867550507171 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 5920700466723361425} - - component: {fileID: 3090614207120593224} - m_Layer: 0 - m_Name: Point 0 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &5920700466723361425 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2666246867550507171} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 3, y: -0.6, z: -8} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 61721039009879398} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &3090614207120593224 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2666246867550507171} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3} - m_Name: - m_EditorClassIdentifier: - curve: {fileID: 248757460750153752} - handleType: 0 - leftHandleLocalPosition: {x: 1.0656222, y: -1.8595196, z: -2.744691} - rightHandleLocalPosition: {x: -1.0656222, y: 1.8595196, z: 2.744691} ---- !u!1 &2878855656061414402 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7623930825914093649} - - component: {fileID: 7274598148927711961} - m_Layer: 0 - m_Name: Point 1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7623930825914093649 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2878855656061414402} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.038, y: -0.33, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 61721039009879398} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &7274598148927711961 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2878855656061414402} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3} - m_Name: - m_EditorClassIdentifier: - curve: {fileID: 248757460750153752} - handleType: 0 - leftHandleLocalPosition: {x: 0.15738162, y: 0.12090045, z: -0.4472773} - rightHandleLocalPosition: {x: -0.15738162, y: -0.12090045, z: 0.4472773} --- !u!1 &2977027034337794333 GameObject: m_ObjectHideFlags: 0 @@ -1671,7 +1673,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &7258878608994582430 Transform: m_ObjectHideFlags: 0 @@ -1719,53 +1721,6 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 ---- !u!1 &2981963311355412411 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 6042914355350803810} - - component: {fileID: 6912659055694980456} - m_Layer: 0 - m_Name: Point 1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &6042914355350803810 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2981963311355412411} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.869, y: -2.05, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 5667737719173917023} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &6912659055694980456 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2981963311355412411} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3} - m_Name: - m_EditorClassIdentifier: - curve: {fileID: 3533788772796665378} - handleType: 0 - leftHandleLocalPosition: {x: 0.12403858, y: 0.17140651, z: -0.4437331} - rightHandleLocalPosition: {x: -0.12403858, y: -0.17140651, z: 0.4437331} --- !u!1 &3040834920837458945 GameObject: m_ObjectHideFlags: 0 @@ -2130,53 +2085,6 @@ SpriteRenderer: m_WasSpriteAssigned: 0 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &3660962904005519842 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7966628660622947812} - - component: {fileID: 953851313757230155} - m_Layer: 0 - m_Name: Point 2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7966628660622947812 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3660962904005519842} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -3, y: -4.5, z: 8} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 61721039009879398} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &953851313757230155 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3660962904005519842} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3} - m_Name: - m_EditorClassIdentifier: - curve: {fileID: 248757460750153752} - handleType: 0 - leftHandleLocalPosition: {x: 1.1559324, y: 2.6457558, z: -3.1863127} - rightHandleLocalPosition: {x: -1.1559324, y: -2.6457558, z: 3.1863127} --- !u!1 &3742810944473094226 GameObject: m_ObjectHideFlags: 0 @@ -2288,6 +2196,7 @@ Transform: m_Children: - {fileID: 8380209919518305174} - {fileID: 4468064543835661468} + - {fileID: 4580764379744752145} m_Father: {fileID: 1483789816297415762} m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2363,7 +2272,7 @@ SpriteRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_Sprite: {fileID: 8050164209934277894, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 1, g: 0, b: 0, a: 0.5176471} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 @@ -2799,6 +2708,10 @@ MonoBehaviour: triggersAutoplay: 1 startBeat: 0 type: 0 + path: 1 + Shadow: {fileID: 2136808730019920255} + ShadowInstance: {fileID: 0} + awakeAnim: HitPosition: - {fileID: 320160549894608069} - {fileID: 8785326923463350633} @@ -2808,11 +2721,25 @@ MonoBehaviour: - {fileID: 6402550105555280064} HitPositionOffset: - 0 - - 0.6 - - 0.75 - - 0.9 - - 0.75 - - 0.75 + - 0.65 + - 0.825 + - 0.9875 + - 0.8 + - 0.625 + StartPositionOffset: + - {x: 1.5, y: 0, z: -9} + - {x: 1.5, y: 0, z: -8} + - {x: 1, y: 0, z: -8.75} + - {x: -2.25, y: 0, z: -10} + - {x: 0.25, y: 0, z: -8.5} + - {x: 2.25, y: 0, z: -9.5} + ItemSlipRt: + - 0 + - 0.13 + - 0.3 + - 0.35 + - 0.3 + - 0.1 --- !u!1 &4199646893499933531 GameObject: m_ObjectHideFlags: 0 @@ -2936,7 +2863,7 @@ SpriteRenderer: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4461166469202109451} - m_Enabled: 1 + m_Enabled: 0 m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 1 @@ -2969,7 +2896,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: -5000 - m_Sprite: {fileID: 21300000, guid: f52b059f715f84d42a7a5e1d3816d2a3, type: 3} + m_Sprite: {fileID: 21300000, guid: 81f0d9c70bb068b468db7d0af31cf321, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 0.46666667} m_FlipX: 0 m_FlipY: 0 @@ -3052,7 +2979,7 @@ SpriteRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_Sprite: {fileID: 8050164209934277894, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 1, g: 0, b: 0, a: 0.5176471} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 @@ -3178,13 +3105,9 @@ MonoBehaviour: CameraPosition: - {fileID: 3542369029029140826} - {fileID: 607707502233677433} - HitPosition: - - {fileID: 320160549894608069} - - {fileID: 8785326923463350633} - - {fileID: 1385049542862529938} - - {fileID: 6756604250815000602} - - {fileID: 6607715910393405022} - - {fileID: 6402550105555280064} + ItemHolder: {fileID: 8380209919518305174} + Item: {fileID: 4158625219071088136} + Joe: {fileID: 5897754239051819249} --- !u!1 &6607790457825461986 GameObject: m_ObjectHideFlags: 0 @@ -3267,61 +3190,6 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &6663991283784812510 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 5667737719173917023} - - component: {fileID: 3533788772796665378} - m_Layer: 0 - m_Name: pos2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &5667737719173917023 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6663991283784812510} - 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: 3381147141923375752} - - {fileID: 6042914355350803810} - - {fileID: 7927737211091726128} - m_Father: {fileID: 4312528015478943137} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &3533788772796665378 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6663991283784812510} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3} - m_Name: - m_EditorClassIdentifier: - curveColor: {r: 0, g: 1, b: 0, a: 1} - startPointColor: {r: 1, g: 0, b: 0, a: 1} - endPointColor: {r: 0, g: 0, b: 1, a: 1} - sampling: 25 - keyPoints: - - {fileID: 4037818197586113308} - - {fileID: 6912659055694980456} - - {fileID: 3000941757073882368} - normalizedTime: 0.5 --- !u!1 &6804201553746816326 GameObject: m_ObjectHideFlags: 0 @@ -3805,7 +3673,7 @@ SpriteRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_Sprite: {fileID: 8050164209934277894, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 1, g: 0, b: 0, a: 0.5176471} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 @@ -3840,7 +3708,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7505887227269335280} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0.92, y: -3.46, z: 0} + m_LocalPosition: {x: 0.92, y: -3.9, z: 0} m_LocalScale: {x: 0.64, y: 0.64, z: 1} m_Children: [] m_Father: {fileID: 5764267227668832721} @@ -3989,7 +3857,7 @@ GameObject: m_Component: - component: {fileID: 4312528015478943137} m_Layer: 0 - m_Name: ItemCurves + m_Name: HitItemCurves m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -4005,9 +3873,7 @@ Transform: 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: 61721039009879398} - - {fileID: 5667737719173917023} + m_Children: [] m_Father: {fileID: 1483789816297415762} m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -4199,114 +4065,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8050428555983026514} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -1, z: -8} + m_LocalPosition: {x: 0, y: -0.8, z: -8.25} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 769274001585151052} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &8166085812238329827 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3381147141923375752} - - component: {fileID: 4037818197586113308} - m_Layer: 0 - m_Name: Point 0 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &3381147141923375752 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8166085812238329827} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 3, y: 0.4, z: -8} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 5667737719173917023} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &4037818197586113308 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8166085812238329827} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3} - m_Name: - m_EditorClassIdentifier: - curve: {fileID: 3533788772796665378} - handleType: 0 - leftHandleLocalPosition: {x: 0.6836972, y: -0.037681192, z: -2.3483515} - rightHandleLocalPosition: {x: -0.6836972, y: 0.037681192, z: 2.3483515} ---- !u!1 &8199673185763261806 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 61721039009879398} - - component: {fileID: 248757460750153752} - m_Layer: 0 - m_Name: pos1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &61721039009879398 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8199673185763261806} - 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: 5920700466723361425} - - {fileID: 7623930825914093649} - - {fileID: 7966628660622947812} - m_Father: {fileID: 4312528015478943137} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &248757460750153752 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8199673185763261806} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3} - m_Name: - m_EditorClassIdentifier: - curveColor: {r: 0, g: 1, b: 0, a: 1} - startPointColor: {r: 1, g: 0, b: 0, a: 1} - endPointColor: {r: 0, g: 0, b: 1, a: 1} - sampling: 25 - keyPoints: - - {fileID: 3090614207120593224} - - {fileID: 7274598148927711961} - - {fileID: 953851313757230155} - normalizedTime: 0 --- !u!1 &8614986770603621515 GameObject: m_ObjectHideFlags: 0 @@ -4471,53 +4235,6 @@ SpriteRenderer: m_WasSpriteAssigned: 0 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &8793289760485826644 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7927737211091726128} - - component: {fileID: 3000941757073882368} - m_Layer: 0 - m_Name: Point 2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7927737211091726128 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8793289760485826644} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.5, y: -5, z: 5.5} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 5667737719173917023} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &3000941757073882368 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8793289760485826644} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3} - m_Name: - m_EditorClassIdentifier: - curve: {fileID: 3533788772796665378} - handleType: 0 - leftHandleLocalPosition: {x: 0.50544167, y: 1.3544998, z: -2.1097312} - rightHandleLocalPosition: {x: -0.50544167, y: -1.3544998, z: 2.1097312} --- !u!1 &9073968681161081769 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Beat.anim b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Beat.anim index 2dd120a6..aae5ea76 100644 --- a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Beat.anim +++ b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Beat.anim @@ -3630,7 +3630,7 @@ AnimationClip: m_Level: 0 m_CycleOffset: 0 m_HasAdditiveReferencePose: 0 - m_LoopTime: 1 + m_LoopTime: 0 m_LoopBlend: 0 m_LoopBlendOrientation: 0 m_LoopBlendPositionY: 0 diff --git a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Jab.anim b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Jab.anim index e3b5671d..542f22e8 100644 --- a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Jab.anim +++ b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Jab.anim @@ -3729,7 +3729,7 @@ AnimationClip: m_Level: 0 m_CycleOffset: 0 m_HasAdditiveReferencePose: 0 - m_LoopTime: 1 + m_LoopTime: 0 m_LoopBlend: 0 m_LoopBlendOrientation: 0 m_LoopBlendPositionY: 0 diff --git a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/ManCharge.anim b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/ManCharge.anim index 16d91c1c..10a4d3fe 100644 --- a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/ManCharge.anim +++ b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/ManCharge.anim @@ -5291,7 +5291,7 @@ AnimationClip: m_Level: 0 m_CycleOffset: 0 m_HasAdditiveReferencePose: 0 - m_LoopTime: 1 + m_LoopTime: 0 m_LoopBlend: 0 m_LoopBlendOrientation: 0 m_LoopBlendPositionY: 0 diff --git a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/ManKick.anim b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/ManKick.anim index 27f30496..96a16981 100644 --- a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/ManKick.anim +++ b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/ManKick.anim @@ -5635,7 +5635,7 @@ AnimationClip: m_Level: 0 m_CycleOffset: 0 m_HasAdditiveReferencePose: 0 - m_LoopTime: 1 + m_LoopTime: 0 m_LoopBlend: 0 m_LoopBlendOrientation: 0 m_LoopBlendPositionY: 0 diff --git a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/NoPose.anim b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/NoPose.anim index 10c4ff3a..cc450d1a 100644 --- a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/NoPose.anim +++ b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/NoPose.anim @@ -2127,7 +2127,7 @@ AnimationClip: m_Level: 0 m_CycleOffset: 0 m_HasAdditiveReferencePose: 0 - m_LoopTime: 1 + m_LoopTime: 0 m_LoopBlend: 0 m_LoopBlendOrientation: 0 m_LoopBlendPositionY: 0 diff --git a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Straight.anim b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Straight.anim index 8137ce47..d06e186d 100644 --- a/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Straight.anim +++ b/Assets/Resources/Sprites/Games/KarateMan/anime/karateman/Straight.anim @@ -3080,7 +3080,7 @@ AnimationClip: m_Level: 0 m_CycleOffset: 0 m_HasAdditiveReferencePose: 0 - m_LoopTime: 1 + m_LoopTime: 0 m_LoopBlend: 0 m_LoopBlendOrientation: 0 m_LoopBlendPositionY: 0 diff --git a/Assets/Scripts/Games/KarateMan/KarateManJoeNew.cs b/Assets/Scripts/Games/KarateMan/KarateManJoeNew.cs new file mode 100644 index 00000000..427f1eba --- /dev/null +++ b/Assets/Scripts/Games/KarateMan/KarateManJoeNew.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using HeavenStudio; +using HeavenStudio.Util; + +namespace HeavenStudio.Games.Scripts_KarateMan +{ + public class KarateManJoeNew : MonoBehaviour + { + public Animator anim; + public GameEvent bop = new GameEvent(); + + float lastPunchTime = Single.MinValue; + int inComboId = -1; + public void SetComboId(int id) { inComboId = id; } + + private void Awake() + { + + } + + private void Update() + { + var cond = Conductor.instance; + if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeats > bop.startBeat) + { + anim.Play("Beat", -1, 0); + } + + if (PlayerInput.Pressed(true)) + { + if (!KarateManNew.instance.IsExpectingInputNow()) + { + Punch(1); + Jukebox.PlayOneShotGame("karateman/swingNoHit", forcePlay: true); + } + } + else if (PlayerInput.AltPressedUp()) + { + if (!KarateManNew.instance.IsExpectingInputNow()) + { + if (inComboId != -1 && !KarateManNew.instance.IsExpectingInputNow()) + { + //let go too early, make joe spin later + inComboId = -1; + } + } + } + } + + public void Punch(int forceHand = 0) + { + var cond = Conductor.instance; + switch (forceHand) + { + case 0: + if (cond.songPositionInBeats - lastPunchTime < 0.25f + (Minigame.LateTime() - 1f)) + { + lastPunchTime = Single.MinValue; + anim.Play("Straight", -1, 0); + } + else + { + lastPunchTime = cond.songPositionInBeats; + anim.Play("Jab", -1, 0); + } + break; + case 1: + anim.Play("Jab", -1, 0); + break; + case 2: + anim.Play("Straight", -1, 0); + break; + } + bop.startBeat = cond.songPositionInBeats + 0.5f; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Games/KarateMan/KarateManJoeNew.cs.meta b/Assets/Scripts/Games/KarateMan/KarateManJoeNew.cs.meta new file mode 100644 index 00000000..801dec87 --- /dev/null +++ b/Assets/Scripts/Games/KarateMan/KarateManJoeNew.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e6ef00cb3bdcfd647bd634066ce4107d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/KarateMan/KarateManNew.cs b/Assets/Scripts/Games/KarateMan/KarateManNew.cs index 05202038..87055b27 100644 --- a/Assets/Scripts/Games/KarateMan/KarateManNew.cs +++ b/Assets/Scripts/Games/KarateMan/KarateManNew.cs @@ -15,7 +15,7 @@ namespace HeavenStudio.Games.Loaders return new Minigame("karateManNew", "Karate Man [INDEV REWORK]", "70A8D8", false, false, new List() { new GameAction("bop", delegate { }, 0.5f, true), - new GameAction("hit", delegate{}, 2, false, + new GameAction("hit", delegate { var e = eventCaller.currentEntity; KarateManNew.instance.CreateItem(e.beat, e.type); }, 2, false, new List() { new Param("type", KarateManNew.HitType.Pot, "Object", "The object to fire") @@ -27,7 +27,7 @@ namespace HeavenStudio.Games.Loaders new Param("colorA", new Color(), "Custom Color", "The color to use when the bulb type is set to Custom") }), new GameAction("kick", delegate { }, 4.5f), - new GameAction("combo", delegate { }, 4f), + new GameAction("combo", delegate { var e = eventCaller.currentEntity; KarateManNew.instance.Combo(e.beat); }, 4f), new GameAction("hit3", delegate { }, 1f, false, new List() { @@ -131,15 +131,16 @@ namespace HeavenStudio.Games public Transform[] CameraPosition; Vector3 cameraPosition; - + //pot trajectory stuff - public Transform[] HitPosition; - static Vector2 StartPositionOffset = new Vector2(-3f, -8f); - //https://www.desmos.com/calculator/ycn9v62i4f + public Transform ItemHolder; + public GameObject Item; + public KarateManJoeNew Joe; private void Awake() { instance = this; + KarateManPotNew.ResetLastCombo(); cameraPosition = CameraPosition[0].position; } @@ -152,5 +153,71 @@ namespace HeavenStudio.Games { GameCamera.additionalPosition = cameraPosition - GameCamera.defaultPosition; } + + public void CreateItem(float beat, int type) + { + + string outSound; + + switch (type) + { + case (int) HitType.Pot: + if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f) + outSound = "karateman/objectOut"; + else + outSound = "karateman/offbeatObjectOut"; + CreateItemInstance(beat, "Item00"); + break; + default: + if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f) + outSound = "karateman/objectOut"; + else + outSound = "karateman/offbeatObjectOut"; + CreateItemInstance(beat, "Item00"); + break; + } + Jukebox.PlayOneShotGame(outSound, forcePlay: true); + } + + public void Combo(float beat) + { + Jukebox.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true); + + int comboId = KarateManPotNew.GetNewCombo(); + + BeatAction.New(gameObject, new List() + { + new BeatAction.Action(beat, delegate { CreateItemInstance(beat, "Item00", KarateManPotNew.ItemType.ComboPot1, comboId); }), + new BeatAction.Action(beat + 0.25f, delegate { CreateItemInstance(beat + 0.25f, "Item00", KarateManPotNew.ItemType.ComboPot2, comboId); }), + new BeatAction.Action(beat + 0.5f, delegate { CreateItemInstance(beat + 0.5f, "Item00", KarateManPotNew.ItemType.ComboPot3, comboId); }), + new BeatAction.Action(beat + 0.75f, delegate { CreateItemInstance(beat + 0.75f, "Item00", KarateManPotNew.ItemType.ComboPot4, comboId); }), + new BeatAction.Action(beat + 1f, delegate { CreateItemInstance(beat + 1f, "Item00", KarateManPotNew.ItemType.ComboPot5, comboId); }), + new BeatAction.Action(beat + 1.5f, delegate { CreateItemInstance(beat + 1.5f, "Item05", KarateManPotNew.ItemType.ComboBarrel, comboId); }), + }); + + MultiSound.Play(new MultiSound.Sound[] + { + new MultiSound.Sound("karateman/punchy1", beat + 1f), + new MultiSound.Sound("karateman/punchy2", beat + 1.25f), + new MultiSound.Sound("karateman/punchy3", beat + 1.5f), + new MultiSound.Sound("karateman/punchy4", beat + 1.75f), + new MultiSound.Sound("karateman/ko", beat + 2f), + new MultiSound.Sound("karateman/pow", beat + 2.5f) + }, forcePlay: true); + } + + GameObject CreateItemInstance(float beat, string awakeAnim, KarateManPotNew.ItemType type = KarateManPotNew.ItemType.Pot, int comboId = -1) + { + GameObject mobj = GameObject.Instantiate(Item, ItemHolder); + KarateManPotNew mobjDat = mobj.GetComponent(); + mobjDat.type = type; + mobjDat.startBeat = beat; + mobjDat.awakeAnim = awakeAnim; + mobjDat.comboId = comboId; + + mobj.SetActive(true); + + return mobj; + } } } \ No newline at end of file diff --git a/Assets/Scripts/Games/KarateMan/KarateManPotNew.cs b/Assets/Scripts/Games/KarateMan/KarateManPotNew.cs index 02635898..464c9e6f 100644 --- a/Assets/Scripts/Games/KarateMan/KarateManPotNew.cs +++ b/Assets/Scripts/Games/KarateMan/KarateManPotNew.cs @@ -11,7 +11,18 @@ namespace HeavenStudio.Games.Scripts_KarateMan public float startBeat; public ItemType type; public int path = 1; - int status = 0; + + public GameObject Shadow; + public GameObject ShadowInstance; + + public string awakeAnim; + FlyStatus status = FlyStatus.Fly; + + public int comboId = -1; + static int _lastCombo = -1; + public static int LastCombo { get { return _lastCombo; } } + public static int GetNewCombo() { _lastCombo++; return _lastCombo; } + public static void ResetLastCombo() { _lastCombo = -1; } public enum ItemType { Pot, // path 1 @@ -43,26 +54,28 @@ namespace HeavenStudio.Games.Scripts_KarateMan //pot trajectory stuff public Transform[] HitPosition; public float[] HitPositionOffset; - static Vector3 StartPositionOffset = new Vector3(3f, 0f, -8f); + public Vector3[] StartPositionOffset; + public float[] ItemSlipRt; float ProgressToHitPosition(float progress) { - return progress + (HitPositionOffset[path] -0.5f); + return progress + (HitPositionOffset[path] - 0.5f); } Vector3 ProgressToFlyPosition() { var cond = Conductor.instance; - float progress = Mathf.Min(cond.GetPositionFromBeat(startBeat, 2f), 1f); + float progress = Mathf.Min(cond.GetPositionFromBeat(startBeat, 2f), 1f - ItemSlipRt[path]); float progressToHitPosition = ProgressToHitPosition(progress); + Vector3 hitPosition = HitPosition[path].position; //https://www.desmos.com/calculator/ycn9v62i4f float offset = HitPositionOffset[path]; float flyHeight = (progressToHitPosition*(progressToHitPosition-1f))/(offset*(offset-1f)); float floorHeight = HitPosition[0].position.y; - Vector3 startPosition = transform.position + StartPositionOffset; - Vector3 endPosition = transform.position - StartPositionOffset; + Vector3 startPosition = hitPosition + StartPositionOffset[path]; + Vector3 endPosition = hitPosition - StartPositionOffset[path]; Vector3 flyPosition = new Vector3( Mathf.Lerp(startPosition.x, endPosition.x, progress), floorHeight + (HitPosition[path].position.y - floorHeight) * flyHeight, @@ -74,5 +87,140 @@ namespace HeavenStudio.Games.Scripts_KarateMan } return flyPosition; } + + void Awake() + { + switch (type) + { + case ItemType.ComboPot1: + KarateManNew.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ComboStartJustOrNg, ComboStartThrough, ComboStartOut); + path = 1; + break; + case ItemType.ComboPot2: + path = 1; + break; + case ItemType.ComboPot3: + path = 2; + break; + case ItemType.ComboPot4: + path = 3; + //if the button isn't held anymore make Joe spin + break; + case ItemType.ComboPot5: + path = 4; + break; + case ItemType.ComboBarrel: + path = 5; + //check for button release + break; + default: + KarateManNew.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ItemJustOrNg, ItemThrough, ItemOut); + path = 1; + comboId = -1; + break; + } + + float floorHeight = HitPosition[0].position.y; + transform.position = ProgressToFlyPosition(); + + Animator mobjAnim = GetComponent(); + mobjAnim.Play(awakeAnim, -1, 0); + transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-360f * Time.deltaTime) + UnityEngine.Random.Range(0f, 360f)); + + ShadowInstance = GameObject.Instantiate(Shadow, KarateManNew.instance.ItemHolder); + ShadowInstance.SetActive(true); + ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z); + } + + void Update() + { + var cond = Conductor.instance; + float floorHeight = HitPosition[0].position.y; + ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z); + switch (status) + { + case FlyStatus.Fly: + float prog = cond.GetPositionFromBeat(startBeat, 2f); + transform.position = ProgressToFlyPosition(); + if (prog >= 2f) { + GameObject.Destroy(ShadowInstance.gameObject); + GameObject.Destroy(gameObject); + return; + } + else if (prog < 1f - ItemSlipRt[path]) { + transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (90f * Time.deltaTime * (1/cond.pitchedSecPerBeat))); + } + break; + case FlyStatus.Hit: + //TEMPORARY + GameObject.Destroy(ShadowInstance.gameObject); + GameObject.Destroy(gameObject); + return; + case FlyStatus.NG: + //TEMPORARY + GameObject.Destroy(ShadowInstance.gameObject); + GameObject.Destroy(gameObject); + return; + case FlyStatus.HitWeak: + break; + } + } + + public void ItemJustOrNg(PlayerActionEvent caller, float state) + { + if (status == FlyStatus.Fly) { + KarateManNew.instance.Joe.Punch(); + if (state <= -1f || state >= 1f) { + Jukebox.PlayOneShot("miss"); + status = FlyStatus.NG; + } + else { + Jukebox.PlayOneShotGame("karateman/potHit", forcePlay: true); + status = FlyStatus.Hit; + } + } + } + + public void ItemWrongAction(PlayerActionEvent caller, float state) + { + //hitting a normal object with the alt input + } + + public void ItemOut(PlayerActionEvent caller) {} + + public void ItemThrough(PlayerActionEvent caller) + { + BeatAction.New(gameObject, new List() + { + new BeatAction.Action(startBeat + 2f, delegate { + //TODO: play miss sound + //deduct flow if applicable + }) + }); + } + + public void ComboStartJustOrNg(PlayerActionEvent caller, float state) + { + if (status == FlyStatus.Fly) { + KarateManNew.instance.Joe.Punch(1); + KarateManNew.instance.Joe.SetComboId(comboId); + if (state <= -1f || state >= 1f) { + Jukebox.PlayOneShot("miss"); + status = FlyStatus.NG; + } + else { + Jukebox.PlayOneShotGame("karateman/potHit", forcePlay: true); + status = FlyStatus.Hit; + } + } + } + + public void ComboStartOut(PlayerActionEvent caller) {} + public void ComboStartThrough(PlayerActionEvent caller) {} + + public void ComboStartWrongAction(PlayerActionEvent caller, float state) + { + //hitting a combo start object with the normal input + } } } \ No newline at end of file diff --git a/Assets/Scripts/Games/PlayerActionEvent.cs b/Assets/Scripts/Games/PlayerActionEvent.cs index 57f9c7b4..83f2b217 100644 --- a/Assets/Scripts/Games/PlayerActionEvent.cs +++ b/Assets/Scripts/Games/PlayerActionEvent.cs @@ -101,22 +101,22 @@ namespace HeavenStudio.Games // Forgive me for those input type names return ( //General inputs, both down and up - (PlayerInput.Pressed() && inputType == InputType.STANDARD_DOWN) || - (PlayerInput.AltPressed() && inputType == InputType.STANDARD_ALT_DOWN) || - (PlayerInput.GetAnyDirectionDown() && inputType == InputType.DIRECTION_DOWN) || - (PlayerInput.PressedUp() && inputType == InputType.STANDARD_UP) || - (PlayerInput.AltPressedUp() && inputType == InputType.STANDARD_ALT_UP) || - (PlayerInput.GetAnyDirectionUp() && inputType == InputType.DIRECTION_UP) || + (PlayerInput.Pressed() && inputType.HasFlag(InputType.STANDARD_DOWN)) || + (PlayerInput.AltPressed() && inputType.HasFlag(InputType.STANDARD_ALT_DOWN)) || + (PlayerInput.GetAnyDirectionDown() && inputType.HasFlag(InputType.DIRECTION_DOWN)) || + (PlayerInput.PressedUp() && inputType.HasFlag(InputType.STANDARD_UP)) || + (PlayerInput.AltPressedUp() && inputType.HasFlag(InputType.STANDARD_ALT_UP)) || + (PlayerInput.GetAnyDirectionUp() && inputType.HasFlag(InputType.DIRECTION_UP)) || //Specific directional inputs - (PlayerInput.GetSpecificDirectionDown(PlayerInput.DOWN) && inputType == InputType.DIRECTION_DOWN_DOWN) || - (PlayerInput.GetSpecificDirectionDown(PlayerInput.UP) && inputType == InputType.DIRECTION_UP_DOWN) || - (PlayerInput.GetSpecificDirectionDown(PlayerInput.LEFT) && inputType == InputType.DIRECTION_LEFT_DOWN) || - (PlayerInput.GetSpecificDirectionDown(PlayerInput.RIGHT) && inputType == InputType.DIRECTION_RIGHT_DOWN) || + (PlayerInput.GetSpecificDirectionDown(PlayerInput.DOWN) && inputType.HasFlag(InputType.DIRECTION_DOWN_DOWN)) || + (PlayerInput.GetSpecificDirectionDown(PlayerInput.UP) && inputType.HasFlag(InputType.DIRECTION_UP_DOWN)) || + (PlayerInput.GetSpecificDirectionDown(PlayerInput.LEFT) && inputType.HasFlag(InputType.DIRECTION_LEFT_DOWN)) || + (PlayerInput.GetSpecificDirectionDown(PlayerInput.RIGHT) && inputType.HasFlag(InputType.DIRECTION_RIGHT_DOWN)) || - (PlayerInput.GetSpecificDirectionUp(PlayerInput.DOWN) && inputType == InputType.DIRECTION_DOWN_UP) || - (PlayerInput.GetSpecificDirectionUp(PlayerInput.UP) && inputType == InputType.DIRECTION_UP_UP) || - (PlayerInput.GetSpecificDirectionUp(PlayerInput.LEFT) && inputType == InputType.DIRECTION_LEFT_UP) || - (PlayerInput.GetSpecificDirectionUp(PlayerInput.RIGHT) && inputType == InputType.DIRECTION_RIGHT_UP) + (PlayerInput.GetSpecificDirectionUp(PlayerInput.DOWN) && inputType.HasFlag(InputType.DIRECTION_DOWN_UP)) || + (PlayerInput.GetSpecificDirectionUp(PlayerInput.UP) && inputType.HasFlag(InputType.DIRECTION_UP_UP)) || + (PlayerInput.GetSpecificDirectionUp(PlayerInput.LEFT) && inputType.HasFlag(InputType.DIRECTION_LEFT_UP)) || + (PlayerInput.GetSpecificDirectionUp(PlayerInput.RIGHT) && inputType.HasFlag(InputType.DIRECTION_RIGHT_UP)) ); } diff --git a/Assets/Scripts/InputType.cs b/Assets/Scripts/InputType.cs index 84572049..b1cc4ade 100644 --- a/Assets/Scripts/InputType.cs +++ b/Assets/Scripts/InputType.cs @@ -5,30 +5,31 @@ using UnityEngine; namespace HeavenStudio { + [System.Flags] public enum InputType : int { //General //------- //Down - STANDARD_DOWN = 0, - STANDARD_ALT_DOWN = 1, - DIRECTION_DOWN = 2, + STANDARD_DOWN = 1<<0, + STANDARD_ALT_DOWN = 1<<1, + DIRECTION_DOWN = 1<<2, //Up - STANDARD_UP = 3, - STANDARD_ALT_UP = 4, - DIRECTION_UP = 5, + STANDARD_UP = 1<<3, + STANDARD_ALT_UP = 1<<4, + DIRECTION_UP = 1<<5, //Specific //-------- //Down - DIRECTION_DOWN_DOWN = 6, - DIRECTION_UP_DOWN = 7, - DIRECTION_LEFT_DOWN = 8, - DIRECTION_RIGHT_DOWN = 9, + DIRECTION_DOWN_DOWN = 1<<6, + DIRECTION_UP_DOWN = 1<<7, + DIRECTION_LEFT_DOWN = 1<<8, + DIRECTION_RIGHT_DOWN = 1<<9, //Up - DIRECTION_DOWN_UP = 10, - DIRECTION_UP_UP = 11, - DIRECTION_LEFT_UP = 12, - DIRECTION_RIGHT_UP = 13 + DIRECTION_DOWN_UP = 1<<10, + DIRECTION_UP_UP = 1<<11, + DIRECTION_LEFT_UP = 1<<12, + DIRECTION_RIGHT_UP = 1<<13 } } \ No newline at end of file