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
This commit is contained in:
Carson Kompon 2022-02-26 01:31:35 -05:00
parent 5a89e9608d
commit 70962f50a0
7 changed files with 187 additions and 93 deletions

View file

@ -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

View file

@ -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: []

View file

@ -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<SpriteRenderer>();
if (tint != default && tint != Color.black) {
sr.sprite = ObjectBottomSprites[type];
sr.color = tint;
p.BulbLightSprite.SetActive(true);
p.BulbLightSprite.GetComponent<SpriteRenderer>().color = tint;
}
break;
case 2:

View file

@ -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<Animator>();
spriteComp = Sprite.GetComponent<SpriteRenderer>();
shadowSpriteComp = Shadow.GetComponent<SpriteRenderer>();
bulbLightSpriteComp = BulbLightSprite.GetComponent<SpriteRenderer>();
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()

View file

@ -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<Param>()
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<Param>()
{
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),

View file

@ -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<SpriteRenderer>();
InvokeRepeating("ToggleVisibility", 0f, flickerInterval);
}
// Update is called once per frame
void ToggleVisibility()
{
sr.enabled = !sr.enabled;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e61c91c33ba01f1409c503668f734047
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: