From 4403a3dd26e7641bede8264ee980e4f31acd1ece Mon Sep 17 00:00:00 2001 From: Carson Kompon Date: Sun, 27 Feb 2022 12:02:46 -0500 Subject: [PATCH] Added custom shadow colours And specific shadow colours for preset background types --- Assets/Resources/Games/karateman.prefab | 12 ++++++- Assets/Scripts/Beatmap.cs | 1 + Assets/Scripts/Games/KarateMan/KarateMan.cs | 38 ++++++++++++++++----- Assets/Scripts/Minigames.cs | 10 +++--- 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/Assets/Resources/Games/karateman.prefab b/Assets/Resources/Games/karateman.prefab index 7fc2e68b..10a80c70 100644 --- a/Assets/Resources/Games/karateman.prefab +++ b/Assets/Resources/Games/karateman.prefab @@ -17775,6 +17775,13 @@ MonoBehaviour: - {r: 1, g: 0.58431375, b: 0.3137255, a: 1} - {r: 0.9607844, g: 0.7725491, b: 0.78823537, a: 1} - {r: 0, g: 0, b: 0, a: 0} + ShadowColors: + - {r: 0.84313726, g: 0.52156866, b: 0.23137255, a: 1} + - {r: 0.88235295, g: 0.41960785, b: 0.5294118, a: 1} + - {r: 0.3137255, g: 0.31764707, b: 0.40784317, a: 1} + - {r: 0, g: 0, b: 0, a: 1} + - {r: 0.454902, g: 0.19607845, b: 0.121568635, a: 1} + - {r: 0.654902, g: 0.4156863, b: 0.45882356, a: 1} Pot: {fileID: 7248900332380919981} Bomb: {fileID: 1878496493894552565} KarateJoe: {fileID: 7248900332013002443} @@ -17799,7 +17806,10 @@ MonoBehaviour: - {fileID: 21300000, guid: f05694d1ff974fe4387e487d025edede, type: 3} BGSprite: {fileID: 7248900333330862853} BGFXSprite: {fileID: 7037067448840752386} + BGType: 0 BGColor: {r: 0.94117653, g: 0.91372555, b: 0.43921572, a: 1} + Shadow: 0 + ShadowColor: {r: 0, g: 0, b: 0, a: 0} comboRef: {fileID: 1174851578296134715} HIT3Ref: {fileID: 6398113137460299953} Numbers: @@ -17859,7 +17869,7 @@ Transform: m_GameObject: {fileID: 7248900333330862855} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 600, y: 600, z: 1} + m_LocalScale: {x: 300, y: 300, z: 1} m_Children: [] m_Father: {fileID: 7248900332961029735} m_RootOrder: 0 diff --git a/Assets/Scripts/Beatmap.cs b/Assets/Scripts/Beatmap.cs index 3e62aef8..c52efa68 100644 --- a/Assets/Scripts/Beatmap.cs +++ b/Assets/Scripts/Beatmap.cs @@ -26,6 +26,7 @@ namespace RhythmHeavenMania [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valC; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type; + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type2; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public EasingFunction.Ease ease; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorA; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorB; diff --git a/Assets/Scripts/Games/KarateMan/KarateMan.cs b/Assets/Scripts/Games/KarateMan/KarateMan.cs index 7e2d2131..67f27725 100644 --- a/Assets/Scripts/Games/KarateMan/KarateMan.cs +++ b/Assets/Scripts/Games/KarateMan/KarateMan.cs @@ -27,8 +27,15 @@ namespace RhythmHeavenMania.Games.KarateMan Custom } + public enum ShadowType + { + Tinted, + Custom + } + public Color[] LightBulbColors; public Color[] BackgroundColors; + public Color[] ShadowColors; public static Color ShadowBlendColor = new Color(195f / 255f, 48f / 255f, 2f / 255f); const float hitVoiceOffset = 0.042f; @@ -47,8 +54,12 @@ namespace RhythmHeavenMania.Games.KarateMan public SpriteRenderer BGSprite; public SpriteRenderer BGFXSprite; + public BackgroundType BGType = BackgroundType.Yellow; public Color BGColor; + public ShadowType Shadow = ShadowType.Tinted; + public Color ShadowColor = Color.black; + private float newBeat; public GameEvent bop = new GameEvent(); @@ -72,13 +83,15 @@ namespace RhythmHeavenMania.Games.KarateMan private void Awake() { instance = this; + BGType = 0; BGColor = BackgroundColors[0]; + Shadow = 0; } public override void OnGameSwitch() { base.OnGameSwitch(); - SetBackgroundColor(BGColor); + SetBackgroundColor((int)BGType, (int)Shadow, BGColor, ShadowColor); } public void Combo(float beat) @@ -257,11 +270,13 @@ namespace RhythmHeavenMania.Games.KarateMan BGFXSprite.enabled = false; } - public void SetBackgroundColor(Color color) + public void SetBackgroundColor(int type, int shadowType, Color backgroundColor, Color shadowColor) { - Debug.Log("THE COLOR IS " + color.ToString()); - BGColor = color; - BGSprite.color = color; + BGType = (BackgroundType)type; + BGColor = backgroundColor; + BGSprite.color = backgroundColor; + Shadow = (ShadowType)shadowType; + ShadowColor = shadowColor; } public void Bop(float beat, float length) @@ -312,9 +327,16 @@ namespace RhythmHeavenMania.Games.KarateMan public Color GetShadowColor() { - var col = Color.LerpUnclamped(KarateMan.instance.BGColor, KarateMan.ShadowBlendColor, 0.45f); - - return col; + if(Shadow == ShadowType.Custom) + { + return ShadowColor; + } + else if(BGType < BackgroundType.Custom) + { + return ShadowColors[(int)BGType]; + } + + return Color.LerpUnclamped(BGColor, ShadowBlendColor, 0.45f); } } } \ No newline at end of file diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 9af31c94..d644c9d5 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -252,13 +252,15 @@ namespace RhythmHeavenMania new GameAction("set background color", delegate { var e = eventCaller.currentEntity; var c = KarateMan.instance.BackgroundColors[e.type]; + Debug.Log("TYPE=" + e.type.ToString() + ", SHADOW=" + e.type2.ToString()); if(e.type == (int)KarateMan.BackgroundType.Custom) c = e.colorA; - Debug.Log("type - " + e.type.ToString()); - KarateMan.instance.SetBackgroundColor(c); + KarateMan.instance.SetBackgroundColor(e.type, e.type2, c, e.colorB); }, 1f, false, new List() { - new Param("type", KarateMan.BackgroundType.Yellow, "Type"), - new Param("colorA", new Color(), "Custom Color") + new Param("type", KarateMan.BackgroundType.Yellow, "Background Type"), + new Param("type2", KarateMan.ShadowType.Tinted, "Shadow Type"), + new Param("colorA", new Color(), "Custom Background Color"), + new Param("colorB", new Color(), "Custom Shadow Color") }), new GameAction("tacobell", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 6); }, 2), }),