Fixed AudioSource.time bug, check Conductor.cs for comment.

This commit is contained in:
Starpelly 2021-12-26 23:48:39 -05:00
parent 4b3bfeda1b
commit ff6bce2806
16 changed files with 413 additions and 25 deletions

View file

@ -72,7 +72,7 @@ AnimatorState:
m_SpeedParameter: m_SpeedParameter:
m_MirrorParameter: m_MirrorParameter:
m_CycleOffsetParameter: m_CycleOffsetParameter:
m_TimeParameter: m_TimeParameter: time
--- !u!1102 &6545529569560433763 --- !u!1102 &6545529569560433763
AnimatorState: AnimatorState:
serializedVersion: 6 serializedVersion: 6

View file

@ -14,7 +14,7 @@ AnimatorStateMachine:
m_Position: {x: 200, y: 0, z: 0} m_Position: {x: 200, y: 0, z: 0}
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 5229680916234562666} m_State: {fileID: 5229680916234562666}
m_Position: {x: 290, y: 70, z: 0} m_Position: {x: 300, y: 150, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: de9e3e71d21bccc49b0f8973960575b1
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:

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 12fd4a4ff8d4a4349b7c74c8c290d35c
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:

View file

@ -1371,7 +1371,7 @@ ParticleSystemRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: -100 m_SortingOrder: -300
m_RenderMode: 0 m_RenderMode: 0
m_SortMode: 0 m_SortMode: 0
m_MinParticleSize: 0 m_MinParticleSize: 0
@ -7148,7 +7148,7 @@ MonoBehaviour:
dspSongTime: 0 dspSongTime: 0
musicSource: {fileID: 0} musicSource: {fileID: 0}
firstBeatOffset: 0 firstBeatOffset: 0
beatsPerLoop: 4 beatsPerLoop: 2
completedLoops: 0 completedLoops: 0
loopPositionInBeats: 0 loopPositionInBeats: 0
loopPositionInAnalog: 0 loopPositionInAnalog: 0
@ -7261,7 +7261,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &490794386 --- !u!1 &490794386
GameObject: GameObject:
@ -11193,6 +11193,88 @@ Transform:
m_Father: {fileID: 1144790344} m_Father: {fileID: 1144790344}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1351316437
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1351316438}
- component: {fileID: 1351316439}
m_Layer: 0
m_Name: Square
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1351316438
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1351316437}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.0225, y: -0.2818, z: 0}
m_LocalScale: {x: 1.7749, y: 5.0237, z: 1}
m_Children: []
m_Father: {fileID: 2018765196}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &1351316439
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1351316437}
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: -200
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
m_Color: {r: 0, g: 0, b: 0.45098042, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1407723739 --- !u!1 &1407723739
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -12890,6 +12972,101 @@ MonoBehaviour:
OuterCircle: {fileID: 0} OuterCircle: {fileID: 0}
InnerCircle: {fileID: 0} InnerCircle: {fileID: 0}
Circle: {fileID: 0} Circle: {fileID: 0}
--- !u!1 &1776916804
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1776916807}
- component: {fileID: 1776916806}
- component: {fileID: 1776916805}
m_Layer: 0
m_Name: Square
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1776916805
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1776916804}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 490e729f742a40644a3a2abd88fce1a3, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!212 &1776916806
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1776916804}
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: 2945
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1776916807
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1776916804}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.3796077, y: 2.0854568, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1810132820 --- !u!1 &1810132820
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -14041,7 +14218,8 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.0023, y: 4.0373, z: 0} m_LocalPosition: {x: 0.0023, y: 4.0373, z: 0}
m_LocalScale: {x: 1.7275732, y: 1.7920761, z: 1.7214477} m_LocalScale: {x: 1.7275732, y: 1.7920761, z: 1.7214477}
m_Children: [] m_Children:
- {fileID: 1351316438}
m_Father: {fileID: 6433985} m_Father: {fileID: 6433985}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -14209,7 +14387,7 @@ Transform:
m_LocalScale: {x: 4000, y: 4000, z: 1} m_LocalScale: {x: 4000, y: 4000, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2072389417 --- !u!114 &2072389417
MonoBehaviour: MonoBehaviour:
@ -14357,15 +14535,15 @@ SpriteRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 30 m_SortingOrder: 30
m_Sprite: {fileID: 21300000, guid: 523719bd3643eea4e8b4e418b4571b7a, type: 3} m_Sprite: {fileID: 21300000, guid: 7b1636bc53db72742b5cdfd9c94a8c44, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 0.3764706} m_Color: {r: 1, g: 1, b: 1, a: 0.3764706}
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 12.8, y: 7.2} m_Size: {x: 17.777779, y: 10}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 0 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!4 &2127056960 --- !u!4 &2127056960

View file

@ -4,6 +4,8 @@ using UnityEngine;
using Starpelly; using Starpelly;
// I CANNOT STRESS THIS ENOUGH, SET "Project Settings/Audio/DSP Buffer Size" to "Best latency" or else AudioSource.time WILL NOT update every frame.
namespace RhythmHeavenMania namespace RhythmHeavenMania
{ {
[RequireComponent(typeof(AudioSource))] [RequireComponent(typeof(AudioSource))]
@ -71,7 +73,7 @@ namespace RhythmHeavenMania
// musicSource.Play(); // musicSource.Play();
} }
void Update() public void Update()
{ {
// Conductor.instance.musicSource.pitch = Time.timeScale; // Conductor.instance.musicSource.pitch = Time.timeScale;
@ -99,9 +101,8 @@ namespace RhythmHeavenMania
public float GetLoopPositionFromBeat(float startBeat, float length) public float GetLoopPositionFromBeat(float startBeat, float length)
{ {
float final = Starpelly.Mathp.Normalize(songPositionInBeats, startBeat, startBeat + length); float a = Mathp.Normalize(songPositionInBeats, startBeat, startBeat + length);
return a;
return final;
} }
public void SetBpm(float bpm) public void SetBpm(float bpm)

View file

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 50 executionOrder: -20
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:

View file

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 150 executionOrder: -8
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:

View file

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 100 executionOrder: -10
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:

View file

@ -112,7 +112,13 @@ namespace RhythmHeavenMania.Games.ClappyTrio
{ {
SetFace(i, 4); SetFace(i, 4);
Lion[i].GetComponent<Animator>().Play("Clap", 0, 0); Lion[i].GetComponent<Animator>().Play("Clap", 0, 0);
Jukebox.PlayOneShotGame("clappyTrio/leftClap");
// lazy fix rn
if (i > 0)
Jukebox.PlayOneShotGame("clappyTrio/middleClap");
else
Jukebox.PlayOneShotGame("clappyTrio/leftClap");
clapIndex++; clapIndex++;
} }
break; break;

View file

@ -32,12 +32,17 @@ namespace RhythmHeavenMania.Games.Spaceball
float beatLength = 1f; float beatLength = 1f;
if (high) beatLength = 2f; if (high) beatLength = 2f;
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.2f); float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.15f);
print(normalizedBeatAnim + " " + Time.frameCount);
if (high) if (high)
{
anim.Play("BallHigh", 0, normalizedBeatAnim); anim.Play("BallHigh", 0, normalizedBeatAnim);
else }
else
{
anim.Play("BallLow", 0, normalizedBeatAnim); anim.Play("BallLow", 0, normalizedBeatAnim);
}
anim.speed = 0; anim.speed = 0;

View file

@ -37,6 +37,7 @@ namespace RhythmHeavenMania.Games.Spaceball
anim = GetComponent<Animator>(); anim = GetComponent<Animator>();
} }
int bruh;
private void Update() private void Update()
{ {
if (EligibleHits.Count == 0) if (EligibleHits.Count == 0)
@ -46,6 +47,12 @@ namespace RhythmHeavenMania.Games.Spaceball
{ {
Swing(); Swing();
} }
if (Conductor.instance.songPositionInBeats >= 5f && bruh == 0)
{
Swing();
bruh++;
}
} }
public void SetCostume(int costume) public void SetCostume(int costume)

View file

@ -6,9 +6,8 @@ namespace RhythmHeavenMania.Tests
{ {
public class WTF : MonoBehaviour public class WTF : MonoBehaviour
{ {
// Start is called before the first frame update private void FixedUpdate()
void Start()
{ {
} }
} }
} }

View file

@ -4,7 +4,7 @@
{ {
"beat": 0, "beat": 0,
"length": 0, "length": 0,
"valA": 170, "valA": 20,
"datamodel": "spaceball/cameraZoom" "datamodel": "spaceball/cameraZoom"
}, },
{ {