Merge pull request #16 from CarsonKompon/karate-man-background-color

Karate Man - Background Colours & Shadow Colours
This commit is contained in:
Jenny Crowe 2022-02-27 14:50:26 -07:00 committed by GitHub
commit 80d0f28b37
6 changed files with 204 additions and 33 deletions

View File

@ -6257,6 +6257,10 @@ MonoBehaviour:
- {fileID: 3379959602278205485, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - {fileID: 3379959602278205485, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: 8497358629359107968, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - {fileID: 8497358629359107968, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
missEffect: {fileID: 564650125393930190} missEffect: {fileID: 564650125393930190}
shadows:
- {fileID: 7248900332856218914}
- {fileID: 7248900333476518146}
- {fileID: 4233113091070337915}
hitBarrel: 0 hitBarrel: 0
inCombo: 0 inCombo: 0
hitCombo: 0 hitCombo: 0
@ -17442,6 +17446,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 7248900333330862852} - {fileID: 7248900333330862852}
- {fileID: 8701843541313247389}
m_Father: {fileID: 7248900333300803150} m_Father: {fileID: 7248900333300803150}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -17762,6 +17767,21 @@ MonoBehaviour:
- {r: 0.007843138, g: 0.8117647, b: 1, a: 1} - {r: 0.007843138, g: 0.8117647, b: 1, a: 1}
- {r: 233, g: 233, b: 0, a: 1} - {r: 233, g: 233, b: 0, a: 1}
- {r: 0, g: 0, b: 0, a: 0} - {r: 0, g: 0, b: 0, a: 0}
BackgroundColors:
- {r: 0.9411765, g: 0.9137255, b: 0.4392157, a: 1}
- {r: 0.99607843, g: 0.60784316, b: 0.98039216, a: 1}
- {r: 0.42745098, g: 0.6666667, b: 0.8784314, a: 1}
- {r: 1, g: 0.09411766, b: 0, a: 1}
- {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} Pot: {fileID: 7248900332380919981}
Bomb: {fileID: 1878496493894552565} Bomb: {fileID: 1878496493894552565}
KarateJoe: {fileID: 7248900332013002443} KarateJoe: {fileID: 7248900332013002443}
@ -17774,14 +17794,6 @@ MonoBehaviour:
- {fileID: 8671423413994339737, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - {fileID: 8671423413994339737, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: -6341196331951941137, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - {fileID: -6341196331951941137, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: -6283416824598814145, 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: BarrelSprites:
- {fileID: 6524922379630696755, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - {fileID: 6524922379630696755, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: 1156572009758090512, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - {fileID: 1156572009758090512, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
@ -17790,10 +17802,14 @@ MonoBehaviour:
- {fileID: 5805539206011318834, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} - {fileID: 5805539206011318834, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
BGSprites: BGSprites:
- Sprites: - Sprites:
- {fileID: 21300000, guid: 1c02ce8c213d84d4c972dcdcbfbf535c, type: 3}
- {fileID: 21300000, guid: 72431c7c58f54e848bcb7527635bb72b, type: 3} - {fileID: 21300000, guid: 72431c7c58f54e848bcb7527635bb72b, type: 3}
- {fileID: 21300000, guid: f05694d1ff974fe4387e487d025edede, type: 3} - {fileID: 21300000, guid: f05694d1ff974fe4387e487d025edede, type: 3}
BGSprite: {fileID: 7248900333330862853} 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} comboRef: {fileID: 1174851578296134715}
HIT3Ref: {fileID: 6398113137460299953} HIT3Ref: {fileID: 6398113137460299953}
Numbers: Numbers:
@ -17853,7 +17869,7 @@ Transform:
m_GameObject: {fileID: 7248900333330862855} m_GameObject: {fileID: 7248900333330862855}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 300, y: 300, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 7248900332961029735} m_Father: {fileID: 7248900332961029735}
m_RootOrder: 0 m_RootOrder: 0
@ -17898,8 +17914,8 @@ SpriteRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: -300 m_SortingOrder: -300
m_Sprite: {fileID: 21300000, guid: 1c02ce8c213d84d4c972dcdcbfbf535c, type: 3} m_Sprite: {fileID: 7482667652216324306, guid: ef2fa2a75dc283e40b9d4fe1f20dc6fb, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 0.94117653, g: 0.91372555, b: 0.43921572, a: 1}
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
@ -18347,3 +18363,85 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
flickerInterval: 0.1 flickerInterval: 0.1
--- !u!1 &8963803634876878173
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8701843541313247389}
- component: {fileID: 7037067448840752386}
m_Layer: 0
m_Name: FX
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8701843541313247389
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8963803634876878173}
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: 7248900332961029735}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &7037067448840752386
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8963803634876878173}
m_Enabled: 0
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: -299
m_Sprite: {fileID: 21300000, guid: 72431c7c58f54e848bcb7527635bb72b, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 12.8, y: 7.2}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View File

@ -26,6 +26,7 @@ namespace RhythmHeavenMania
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valC; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valC;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type; [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 EasingFunction.Ease ease;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorA; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorA;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorB; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorB;

View File

@ -18,6 +18,7 @@ namespace RhythmHeavenMania.Games.KarateMan
[SerializeField] private SpriteRenderer head; [SerializeField] private SpriteRenderer head;
[SerializeField] private Sprite[] heads; [SerializeField] private Sprite[] heads;
[SerializeField] private GameObject missEffect; [SerializeField] private GameObject missEffect;
[SerializeField] private SpriteRenderer[] shadows;
[Header("Properties")] [Header("Properties")]
public bool hitBarrel = false; public bool hitBarrel = false;
@ -168,6 +169,11 @@ namespace RhythmHeavenMania.Games.KarateMan
Swing(null); Swing(null);
} }
} }
for(int i=0;i < shadows.Length; i++)
{
shadows[i].color = KarateMan.instance.GetShadowColor();
}
} }
public void Combo(Pot p) public void Combo(Pot p)

View File

@ -10,19 +10,33 @@ namespace RhythmHeavenMania.Games.KarateMan
{ {
public enum LightBulbType public enum LightBulbType
{ {
Normal = 0, Normal,
Blue = 1, Blue,
Yellow = 2, Yellow,
Custom = 3 Custom
} }
public Color[] LightBulbColors = new Color[] public enum BackgroundType
{ {
new Color(0, 0, 0, 0), Yellow,
new Color(2, 207, 255), Fushia,
new Color(233, 233, 0), Blue,
new Color(0, 0, 0, 0) Red,
}; Orange,
Pink,
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; const float hitVoiceOffset = 0.042f;
@ -34,13 +48,18 @@ namespace RhythmHeavenMania.Games.KarateMan
public static KarateMan instance { get; set; } public static KarateMan instance { get; set; }
public Sprite[] ObjectSprites; public Sprite[] ObjectSprites;
public Sprite[] ObjectBottomSprites;
public Sprite[] BarrelSprites; public Sprite[] BarrelSprites;
public List<BGSpriteC> BGSprites; public List<BGSpriteC> BGSprites;
public SpriteRenderer BGSprite; 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 bool bgEnabled;
private float newBeat; private float newBeat;
public GameEvent bop = new GameEvent(); public GameEvent bop = new GameEvent();
@ -64,6 +83,15 @@ namespace RhythmHeavenMania.Games.KarateMan
private void Awake() private void Awake()
{ {
instance = this; instance = this;
BGType = 0;
BGColor = BackgroundColors[0];
Shadow = 0;
}
public override void OnGameSwitch()
{
base.OnGameSwitch();
SetBackgroundColor((int)BGType, (int)Shadow, BGColor, ShadowColor);
} }
public void Combo(float beat) public void Combo(float beat)
@ -181,15 +209,15 @@ namespace RhythmHeavenMania.Games.KarateMan
{ {
if (Conductor.instance.ReportBeat(ref newBeat)) if (Conductor.instance.ReportBeat(ref newBeat))
{ {
if (bgEnabled) if (BGFXSprite.enabled)
{ {
if (bgBeat % 2 == 0) if (bgBeat % 2 == 0)
{ {
BGSprite.sprite = BGSprites[0].Sprites[1]; BGFXSprite.sprite = BGSprites[0].Sprites[0];
} }
else else
{ {
BGSprite.sprite = BGSprites[0].Sprites[2]; BGFXSprite.sprite = BGSprites[0].Sprites[1];
} }
bgBeat++; bgBeat++;
} }
@ -234,13 +262,21 @@ namespace RhythmHeavenMania.Games.KarateMan
public void BGFXOn() public void BGFXOn()
{ {
bgEnabled = true; BGFXSprite.enabled = true;
} }
public void BGFXOff() public void BGFXOff()
{ {
bgEnabled = false; BGFXSprite.enabled = false;
BGSprite.sprite = BGSprites[0].Sprites[0]; }
public void SetBackgroundColor(int type, int shadowType, Color backgroundColor, Color shadowColor)
{
BGType = (BackgroundType)type;
BGColor = backgroundColor;
BGSprite.color = backgroundColor;
Shadow = (ShadowType)shadowType;
ShadowColor = shadowColor;
} }
public void Bop(float beat, float length) public void Bop(float beat, float length)
@ -288,5 +324,19 @@ namespace RhythmHeavenMania.Games.KarateMan
shadow.transform.SetAsLastSibling(); shadow.transform.SetAsLastSibling();
bomb.GetComponent<Bomb>().shadow = shadow; bomb.GetComponent<Bomb>().shadow = shadow;
} }
public Color GetShadowColor()
{
if(Shadow == ShadowType.Custom)
{
return ShadowColor;
}
else if(BGType < BackgroundType.Custom)
{
return ShadowColors[(int)BGType];
}
return Color.LerpUnclamped(BGColor, ShadowBlendColor, 0.45f);
}
} }
} }

View File

@ -116,10 +116,14 @@ namespace RhythmHeavenMania.Games.KarateMan
private void Update() private void Update()
{ {
if (Conductor.instance.songPositionInBeats >= createBeat) if (Conductor.instance.songPositionInBeats >= createBeat)
{
spriteComp.enabled = true; spriteComp.enabled = true;
shadowSpriteComp.color = KarateMan.instance.GetShadowColor();
}
else else
{
spriteComp.enabled = false; spriteComp.enabled = false;
}
float time2Destroy = Conductor.instance.GetPositionFromBeat(createBeat, 4); float time2Destroy = Conductor.instance.GetPositionFromBeat(createBeat, 4);

View File

@ -233,8 +233,8 @@ namespace RhythmHeavenMania
new GameAction("bulb", delegate { new GameAction("bulb", delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
var c = KarateMan.instance.LightBulbColors[e.type]; var c = KarateMan.instance.LightBulbColors[e.type];
if(e.type == 3) c = e.colorA; if(e.type == (int)KarateMan.LightBulbType.Custom) c = e.colorA;
KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 1, tint: c); KarateMan.instance.Shoot(e.beat, 1, tint: c);
}, 2, false, new List<Param>() }, 2, false, new List<Param>()
{ {
new Param("type", KarateMan.LightBulbType.Normal, "Type"), new Param("type", KarateMan.LightBulbType.Normal, "Type"),
@ -249,6 +249,18 @@ namespace RhythmHeavenMania
new GameAction("prepare", delegate { KarateMan.instance.Prepare(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 1f, true), new GameAction("prepare", delegate { KarateMan.instance.Prepare(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 1f, true),
new GameAction("bgfxon", delegate { KarateMan.instance.BGFXOn(); } ), new GameAction("bgfxon", delegate { KarateMan.instance.BGFXOn(); } ),
new GameAction("bgfxoff", delegate { KarateMan.instance.BGFXOff(); }), new GameAction("bgfxoff", delegate { KarateMan.instance.BGFXOff(); }),
new GameAction("set background color", delegate {
var e = eventCaller.currentEntity;
var c = KarateMan.instance.BackgroundColors[e.type];
if(e.type == (int)KarateMan.BackgroundType.Custom) c = e.colorA;
KarateMan.instance.SetBackgroundColor(e.type, e.type2, c, e.colorB);
}, 0.5f, false, new List<Param>()
{
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), new GameAction("tacobell", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 6); }, 2),
}), }),
new Minigame("spaceSoccer", "Space Soccer", "B888F8", false, false, new List<GameAction>() new Minigame("spaceSoccer", "Space Soccer", "B888F8", false, false, new List<GameAction>()