From 5a89e9608d7c24bef2ba0425613082604d0c456a Mon Sep 17 00:00:00 2001 From: Carson Kompon Date: Fri, 25 Feb 2022 23:57:18 -0500 Subject: [PATCH 1/2] Added Light to the Light Bulb if colour is changed with right click You can now right click on bulb in the editor to change the colour of the light emitted. If the colour is set to black then no light is drawn. --- Assets/Resources/Games/karateman.prefab | 94 +++++++++++++++++- .../KarateMan/karateman_bulb_light.png.meta | 96 +++++++++++++++++++ Assets/Scripts/Games/KarateMan/KarateMan.cs | 8 +- Assets/Scripts/Games/KarateMan/Pot.cs | 2 + Assets/Scripts/Minigames.cs | 5 +- 5 files changed, 202 insertions(+), 3 deletions(-) create mode 100644 Assets/Resources/Sprites/Games/KarateMan/karateman_bulb_light.png.meta diff --git a/Assets/Resources/Games/karateman.prefab b/Assets/Resources/Games/karateman.prefab index 06be357f..a3294769 100644 --- a/Assets/Resources/Games/karateman.prefab +++ b/Assets/Resources/Games/karateman.prefab @@ -6719,7 +6719,8 @@ 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: [] + m_Children: + - {fileID: 7180297105842423010} m_Father: {fileID: 7248900332475218834} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -7022,6 +7023,7 @@ MonoBehaviour: anim: {fileID: 0} Holder: {fileID: 7248900331917783119} Sprite: {fileID: 7248900332269585492} + BottomSprite: {fileID: 8301297041882507163} Shadow: {fileID: 7248900331919671867} isThrown: 0 isHit: 0 @@ -17767,6 +17769,14 @@ MonoBehaviour: - {fileID: 8671423413994339737, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - {fileID: -6341196331951941137, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - {fileID: -6283416824598814145, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} + ObjectBottomSprites: + - {fileID: 0} + - {fileID: 21300000, guid: 2dcc4a0e0420a8e4097445cac4b2e1ab, type: 3} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} BarrelSprites: - {fileID: 6524922379630696755, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - {fileID: 1156572009758090512, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} @@ -18154,6 +18164,88 @@ Transform: m_Father: {fileID: 8457699647532782750} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &8301297041882507163 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7180297105842423010} + - component: {fileID: 1579546270015444335} + m_Layer: 0 + m_Name: BottomSprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7180297105842423010 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8301297041882507163} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.26, y: 0.15, z: 0} + m_LocalScale: {x: 1.3307, y: 1.3307, z: 1.3307} + m_Children: [] + m_Father: {fileID: 7248900332269585493} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1579546270015444335 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8301297041882507163} + 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: 59 + m_Sprite: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1.4, y: 1.4} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 0 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &8746018100916256658 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Sprites/Games/KarateMan/karateman_bulb_light.png.meta b/Assets/Resources/Sprites/Games/KarateMan/karateman_bulb_light.png.meta new file mode 100644 index 00000000..6727345d --- /dev/null +++ b/Assets/Resources/Sprites/Games/KarateMan/karateman_bulb_light.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 2dcc4a0e0420a8e4097445cac4b2e1ab +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/KarateMan/KarateMan.cs b/Assets/Scripts/Games/KarateMan/KarateMan.cs index aa5696e8..d21ba4ba 100644 --- a/Assets/Scripts/Games/KarateMan/KarateMan.cs +++ b/Assets/Scripts/Games/KarateMan/KarateMan.cs @@ -18,6 +18,7 @@ namespace RhythmHeavenMania.Games.KarateMan public static KarateMan instance { get; set; } public Sprite[] ObjectSprites; + public Sprite[] ObjectBottomSprites; public Sprite[] BarrelSprites; public List BGSprites; @@ -73,7 +74,7 @@ namespace RhythmHeavenMania.Games.KarateMan }); } - public void Shoot(float beat, int type, bool combo = false, string throwAnim = "", int comboIndex = 0, Vector2 endShadowPos = new Vector2()) + public void Shoot(float beat, int type, bool combo = false, string throwAnim = "", int comboIndex = 0, Vector2 endShadowPos = new Vector2(), UnityEngine.Color tint = default) { GameObject pot = Instantiate(Pot); pot.transform.parent = Pot.transform.parent; @@ -115,6 +116,11 @@ namespace RhythmHeavenMania.Games.KarateMan case 1: outSnd = "karateman/lightbulbOut"; p.hitSnd = "karateman/lightbulbHit"; + SpriteRenderer sr = p.BottomSprite.GetComponent(); + if (tint != default && tint != Color.black) { + sr.sprite = ObjectBottomSprites[type]; + sr.color = tint; + } break; case 2: if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f) diff --git a/Assets/Scripts/Games/KarateMan/Pot.cs b/Assets/Scripts/Games/KarateMan/Pot.cs index 46d032fa..5ff8c4cc 100644 --- a/Assets/Scripts/Games/KarateMan/Pot.cs +++ b/Assets/Scripts/Games/KarateMan/Pot.cs @@ -15,6 +15,7 @@ namespace RhythmHeavenMania.Games.KarateMan public GameObject Holder; private GameObject newHolder; public GameObject Sprite; + public GameObject BottomSprite; private SpriteRenderer spriteComp; public GameObject Shadow; private SpriteRenderer shadowSpriteComp; @@ -60,6 +61,7 @@ namespace RhythmHeavenMania.Games.KarateMan shadowSpriteComp = Shadow.GetComponent(); Sprite.transform.eulerAngles = new Vector3(0, 0, Random.Range(0, 360)); + BottomSprite.transform.eulerAngles = Sprite.transform.eulerAngles; if (type == 2) hitLength = 14f; diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index a6eb31d3..cdb75265 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -230,7 +230,10 @@ namespace RhythmHeavenMania { new GameAction("bop", delegate { KarateMan.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true), new GameAction("pot", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 0); }, 2), - new GameAction("bulb", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 1); }, 2), + new GameAction("bulb", delegate { var e = eventCaller.currentEntity; KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 1, tint: e.colorA); }, 2, false, new List() + { + new Param("colorA", Color.white, "Light Bulb Color") + }), new GameAction("rock", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 2); }, 2), new GameAction("ball", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 3); }, 2), new GameAction("kick", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 4); }, 4.5f), From 70962f50a08dc514764f7accddbb82799b1d2be9 Mon Sep 17 00:00:00 2001 From: Carson Kompon Date: Sat, 26 Feb 2022 01:31:35 -0500 Subject: [PATCH 2/2] Implemented proper sprite, flickering, and dropdown menu There's now a "type" dropdown menu that allows you to choose between "Normal", "Yellow", "Blue", and "Custom". Custom will use the color specified in the Custom Color field --- Assets/Resources/Games/karateman.prefab | 187 ++++++++++-------- .../KarateMan/karateman_bulb_light.png.meta | 14 +- Assets/Scripts/Games/KarateMan/KarateMan.cs | 21 +- Assets/Scripts/Games/KarateMan/Pot.cs | 13 +- Assets/Scripts/Minigames.cs | 10 +- Assets/Scripts/SpriteFlicker.cs | 24 +++ Assets/Scripts/SpriteFlicker.cs.meta | 11 ++ 7 files changed, 187 insertions(+), 93 deletions(-) create mode 100644 Assets/Scripts/SpriteFlicker.cs create mode 100644 Assets/Scripts/SpriteFlicker.cs.meta diff --git a/Assets/Resources/Games/karateman.prefab b/Assets/Resources/Games/karateman.prefab index a3294769..2452b4e5 100644 --- a/Assets/Resources/Games/karateman.prefab +++ b/Assets/Resources/Games/karateman.prefab @@ -6720,7 +6720,7 @@ Transform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 7180297105842423010} + - {fileID: 2894176741642927925} m_Father: {fileID: 7248900332475218834} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -7023,7 +7023,7 @@ MonoBehaviour: anim: {fileID: 0} Holder: {fileID: 7248900331917783119} Sprite: {fileID: 7248900332269585492} - BottomSprite: {fileID: 8301297041882507163} + BulbLightSprite: {fileID: 8800416197462662414} Shadow: {fileID: 7248900331919671867} isThrown: 0 isHit: 0 @@ -17757,6 +17757,11 @@ MonoBehaviour: m_EditorClassIdentifier: EligibleHits: [] firstEnable: 0 + LightBulbColors: + - {r: 0, g: 0, b: 0, a: 0} + - {r: 0.007843138, g: 0.8117647, b: 1, a: 1} + - {r: 233, g: 233, b: 0, a: 1} + - {r: 0, g: 0, b: 0, a: 0} Pot: {fileID: 7248900332380919981} Bomb: {fileID: 1878496493894552565} KarateJoe: {fileID: 7248900332013002443} @@ -18164,88 +18169,6 @@ Transform: m_Father: {fileID: 8457699647532782750} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &8301297041882507163 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7180297105842423010} - - component: {fileID: 1579546270015444335} - m_Layer: 0 - m_Name: BottomSprite - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7180297105842423010 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8301297041882507163} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.26, y: 0.15, z: 0} - m_LocalScale: {x: 1.3307, y: 1.3307, z: 1.3307} - m_Children: [] - m_Father: {fileID: 7248900332269585493} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &1579546270015444335 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8301297041882507163} - 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: 59 - m_Sprite: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 1.4, y: 1.4} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 0 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 --- !u!1 &8746018100916256658 GameObject: m_ObjectHideFlags: 0 @@ -18328,3 +18251,99 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &8800416197462662414 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2894176741642927925} + - component: {fileID: 7700154717549798099} + - component: {fileID: 8377832867748690547} + m_Layer: 0 + m_Name: BulbLight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &2894176741642927925 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8800416197462662414} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.26, y: 0.02, z: 0} + m_LocalScale: {x: 2.1, y: 2.1, z: 2.1} + m_Children: [] + m_Father: {fileID: 7248900332269585493} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &7700154717549798099 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8800416197462662414} + 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: 60 + m_Sprite: {fileID: 21300000, guid: 2dcc4a0e0420a8e4097445cac4b2e1ab, 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.9444444, y: 1.9444444} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &8377832867748690547 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8800416197462662414} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e61c91c33ba01f1409c503668f734047, type: 3} + m_Name: + m_EditorClassIdentifier: + flickerInterval: 0.1 diff --git a/Assets/Resources/Sprites/Games/KarateMan/karateman_bulb_light.png.meta b/Assets/Resources/Sprites/Games/KarateMan/karateman_bulb_light.png.meta index 6727345d..c5d63061 100644 --- a/Assets/Resources/Sprites/Games/KarateMan/karateman_bulb_light.png.meta +++ b/Assets/Resources/Sprites/Games/KarateMan/karateman_bulb_light.png.meta @@ -46,7 +46,7 @@ TextureImporter: spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 + spritePixelsToUnits: 72 spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 @@ -75,6 +75,18 @@ TextureImporter: overridden: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + 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: [] diff --git a/Assets/Scripts/Games/KarateMan/KarateMan.cs b/Assets/Scripts/Games/KarateMan/KarateMan.cs index d21ba4ba..3ea5dafe 100644 --- a/Assets/Scripts/Games/KarateMan/KarateMan.cs +++ b/Assets/Scripts/Games/KarateMan/KarateMan.cs @@ -8,6 +8,22 @@ namespace RhythmHeavenMania.Games.KarateMan { public class KarateMan : Minigame { + public enum LightBulbType + { + Normal = 0, + Blue = 1, + Yellow = 2, + Custom = 3 + } + + public Color[] LightBulbColors = new Color[] + { + new Color(0, 0, 0, 0), + new Color(2, 207, 255), + new Color(233, 233, 0), + new Color(0, 0, 0, 0) + }; + const float hitVoiceOffset = 0.042f; public GameObject Pot, Bomb; @@ -116,10 +132,9 @@ namespace RhythmHeavenMania.Games.KarateMan case 1: outSnd = "karateman/lightbulbOut"; p.hitSnd = "karateman/lightbulbHit"; - SpriteRenderer sr = p.BottomSprite.GetComponent(); if (tint != default && tint != Color.black) { - sr.sprite = ObjectBottomSprites[type]; - sr.color = tint; + p.BulbLightSprite.SetActive(true); + p.BulbLightSprite.GetComponent().color = tint; } break; case 2: diff --git a/Assets/Scripts/Games/KarateMan/Pot.cs b/Assets/Scripts/Games/KarateMan/Pot.cs index 5ff8c4cc..1e0692c4 100644 --- a/Assets/Scripts/Games/KarateMan/Pot.cs +++ b/Assets/Scripts/Games/KarateMan/Pot.cs @@ -15,10 +15,11 @@ namespace RhythmHeavenMania.Games.KarateMan public GameObject Holder; private GameObject newHolder; public GameObject Sprite; - public GameObject BottomSprite; + public GameObject BulbLightSprite; private SpriteRenderer spriteComp; public GameObject Shadow; private SpriteRenderer shadowSpriteComp; + private SpriteRenderer bulbLightSpriteComp; public bool isThrown; public bool isHit = false; @@ -59,9 +60,10 @@ namespace RhythmHeavenMania.Games.KarateMan anim = GetComponent(); spriteComp = Sprite.GetComponent(); shadowSpriteComp = Shadow.GetComponent(); + bulbLightSpriteComp = BulbLightSprite.GetComponent(); Sprite.transform.eulerAngles = new Vector3(0, 0, Random.Range(0, 360)); - BottomSprite.transform.eulerAngles = Sprite.transform.eulerAngles; + BulbLightSprite.transform.eulerAngles = Sprite.transform.eulerAngles; if (type == 2) hitLength = 14f; @@ -201,12 +203,15 @@ namespace RhythmHeavenMania.Games.KarateMan if (normalizedBeat > 1) { spriteComp.sortingOrder = -20; + bulbLightSpriteComp.sortingOrder = -20; shadowSpriteComp.sortingOrder = -30; } else { // Pots closer to Joe are sorted further back. - spriteComp.sortingOrder = 60 - Mathf.RoundToInt(10f * normalizedBeat); + int newOrder = 60 - Mathf.RoundToInt(10f * normalizedBeat); + spriteComp.sortingOrder = newOrder; + bulbLightSpriteComp.sortingOrder = newOrder; } } @@ -291,6 +296,7 @@ namespace RhythmHeavenMania.Games.KarateMan isHit = true; spriteComp.sortingOrder = 49; + bulbLightSpriteComp.sortingOrder = 49; } public void Miss() @@ -307,6 +313,7 @@ namespace RhythmHeavenMania.Games.KarateMan isThrown = false; anim.enabled = false; spriteComp.sortingOrder = 49; + bulbLightSpriteComp.sortingOrder = 49; } private void NewHolder() diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index cdb75265..c2d8e684 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -230,9 +230,15 @@ namespace RhythmHeavenMania { new GameAction("bop", delegate { KarateMan.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true), new GameAction("pot", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 0); }, 2), - new GameAction("bulb", delegate { var e = eventCaller.currentEntity; KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 1, tint: e.colorA); }, 2, false, new List() + new GameAction("bulb", delegate { + var e = eventCaller.currentEntity; + var c = KarateMan.instance.LightBulbColors[e.type]; + if(e.type == 3) c = e.colorA; + KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 1, tint: c); + }, 2, false, new List() { - new Param("colorA", Color.white, "Light Bulb Color") + new Param("type", KarateMan.LightBulbType.Normal, "Type"), + new Param("colorA", new Color(), "Custom Color") }), new GameAction("rock", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 2); }, 2), new GameAction("ball", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 3); }, 2), diff --git a/Assets/Scripts/SpriteFlicker.cs b/Assets/Scripts/SpriteFlicker.cs new file mode 100644 index 00000000..244735a8 --- /dev/null +++ b/Assets/Scripts/SpriteFlicker.cs @@ -0,0 +1,24 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class SpriteFlicker : MonoBehaviour +{ + + public float flickerInterval; + + SpriteRenderer sr; + + // Start is called before the first frame update + void Start() + { + sr = GetComponent(); + InvokeRepeating("ToggleVisibility", 0f, flickerInterval); + } + + // Update is called once per frame + void ToggleVisibility() + { + sr.enabled = !sr.enabled; + } +} diff --git a/Assets/Scripts/SpriteFlicker.cs.meta b/Assets/Scripts/SpriteFlicker.cs.meta new file mode 100644 index 00000000..202164cd --- /dev/null +++ b/Assets/Scripts/SpriteFlicker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e61c91c33ba01f1409c503668f734047 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: