diff --git a/Assets/Resources/Music/cointoss.wav b/Assets/Resources/Music/cointoss.wav new file mode 100644 index 000000000..f161c623f Binary files /dev/null and b/Assets/Resources/Music/cointoss.wav differ diff --git a/Assets/Resources/Music/cointoss.wav.meta b/Assets/Resources/Music/cointoss.wav.meta new file mode 100644 index 000000000..1fa019bb3 --- /dev/null +++ b/Assets/Resources/Music/cointoss.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: e5cf71158cc9bff4a8fbfbca1e73e500 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Sprites/Games/ClappyTrio/Animations/Prepare.anim b/Assets/Resources/Sprites/Games/ClappyTrio/Animations/Prepare.anim index a0d7dc7ef..8d8213783 100644 --- a/Assets/Resources/Sprites/Games/ClappyTrio/Animations/Prepare.anim +++ b/Assets/Resources/Sprites/Games/ClappyTrio/Animations/Prepare.anim @@ -144,7 +144,64 @@ AnimationClip: m_RotationOrder: 4 path: Hands/handright m_ScaleCurves: [] - m_FloatCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hands/handstogether + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hands/handright + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hands/handleft + classID: 1 + script: {fileID: 0} m_PPtrCurves: - curve: - time: 0 @@ -181,6 +238,27 @@ AnimationClip: m_Extent: {x: 0, y: 0, z: 0} m_ClipBindingConstant: genericBindings: + - serializedVersion: 2 + path: 604036472 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 73026576 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 986104082 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 - serializedVersion: 2 path: 131153305 attribute: 0 @@ -747,6 +825,63 @@ AnimationClip: path: Hands/handright classID: 4 script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hands/handstogether + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hands/handright + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Hands/handleft + classID: 1 + script: {fileID: 0} m_EulerEditorCurves: - curve: serializedVersion: 2 diff --git a/Assets/Scenes/Game.unity b/Assets/Scenes/Game.unity index 49469622a..6c6e60ccb 100644 --- a/Assets/Scenes/Game.unity +++ b/Assets/Scenes/Game.unity @@ -7163,7 +7163,7 @@ AudioSource: m_Enabled: 1 serializedVersion: 4 OutputAudioMixerGroup: {fileID: 0} - m_audioClip: {fileID: 8300000, guid: c0b3e65059fb3cd49aa056342f2246c8, type: 3} + m_audioClip: {fileID: 8300000, guid: 92cf585c80f8fb843964e525aef1406c, type: 3} m_PlayOnAwake: 0 m_Volume: 1 m_Pitch: 1 @@ -12989,7 +12989,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!114 &1776916805 MonoBehaviour: m_ObjectHideFlags: 0 @@ -14407,12 +14407,13 @@ MonoBehaviour: playerEntities: [] currentEvent: 0 currentPlayerEvent: 0 - txt: {fileID: 4900000, guid: 50b54b23c06076c4598134813da27f18, type: 3} + txt: {fileID: 4900000, guid: 4b7512c586e16a847a5b8490bf35e852, type: 3} startOffset: 0.5 GameCamera: {fileID: 519420031} CursorCam: {fileID: 79134728} CircleCursor: {fileID: 1855769658} currentGame: + startBeat: 0 --- !u!212 &2072389418 SpriteRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Conductor.cs b/Assets/Scripts/Conductor.cs index f995e32c7..86efc2416 100644 --- a/Assets/Scripts/Conductor.cs +++ b/Assets/Scripts/Conductor.cs @@ -53,6 +53,10 @@ namespace RhythmHeavenMania public float beatThreshold; + private float lastTime; + private float lastMst_F; + private int framesSinceLastSame; + void Awake() { instance = this; @@ -73,6 +77,12 @@ namespace RhythmHeavenMania // musicSource.Play(); } + public void Play(float startBeat) + { + musicSource.Play(); + + } + public void Update() { // Conductor.instance.musicSource.pitch = Time.timeScale; @@ -85,11 +95,38 @@ namespace RhythmHeavenMania else if (pauseTime > 1) { musicSource.UnPause(); pauseTime = 0; } }*/ + float mst = musicSource.timeSamples / (float)musicSource.clip.frequency; + float mst_f = mst + 0; + + if (mst == lastTime && musicSource.isPlaying) + { + framesSinceLastSame++; + + mst_f = mst_f + (Time.deltaTime * framesSinceLastSame) * musicSource.pitch; + + if (mst_f < lastMst_F) + { + mst_f = lastMst_F; + } + + print($"{lastMst_F}, {mst_f}"); + } + else + { + framesSinceLastSame = 0; + } + + lastTime = mst; + lastMst_F = mst_f; + //determine how many seconds since the song started - songPosition = (float)(musicSource.time - dspSongTime - firstBeatOffset); + songPosition = (float)(mst_f - dspSongTime - firstBeatOffset); //determine how many beats since the song started songPositionInBeats = songPosition / secPerBeat; + // print($"{musicSource.time}(AudioSource.time), {Time.frameCount}(Time.fasrameCount)"); + // print($"{musicSource.time}(0), {mst_f}"); + //calculate the loop position if (songPositionInBeats >= (completedLoops + 1) * beatsPerLoop) diff --git a/Assets/Scripts/EventCaller.cs b/Assets/Scripts/EventCaller.cs index bd49b3e9c..5ff3558c1 100644 --- a/Assets/Scripts/EventCaller.cs +++ b/Assets/Scripts/EventCaller.cs @@ -81,7 +81,7 @@ namespace RhythmHeavenMania // Claps new GameAction("clap", delegate { ClappyTrio.instance.Clap(currentBeat, currentLength); }, true ), - new GameAction("bop", delegate { ClappyTrio.instance.Bop(); } ), + new GameAction("bop", delegate { ClappyTrio.instance.Bop(currentBeat); } ), new GameAction("prepare", delegate { ClappyTrio.instance.Prepare(0); } ), new GameAction("prepare_alt", delegate { ClappyTrio.instance.Prepare(3); } ), diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 74a6148be..a6ea60ac6 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -31,6 +31,7 @@ namespace RhythmHeavenMania Coroutine currentGameSwitchIE; public string currentGame; + public float startBeat; private void Awake() { @@ -55,7 +56,12 @@ namespace RhythmHeavenMania StartCoroutine(Begin()); - SetCurrentGame(eventCaller.GamesHolder.transform.GetComponentsInChildren()[1].name); + // SetCurrentGame(eventCaller.GamesHolder.transform.GetComponentsInChildren()[1].name); + + if (Beatmap.entities.Count >= 1) + { + SetCurrentGame(Beatmap.entities[0].datamodel.Split('/')[0]); + } } private IEnumerator Begin() diff --git a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs index 9425d512d..bfaf0ffa4 100644 --- a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs +++ b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs @@ -177,7 +177,7 @@ namespace RhythmHeavenMania.Games.ClappyTrio Jukebox.PlayOneShotGame("clappyTrio/ready"); } - public void Bop() + public void Bop(float beat) { if (playerHitLast) { @@ -188,15 +188,21 @@ namespace RhythmHeavenMania.Games.ClappyTrio } else { - for (int i = 0; i < Lion.Count; i++) + var a = EventCaller.GetAllInGameManagerList("clappyTrio", new string[] { "clap" }); + var b = a.FindAll(c => c.beat < beat); + + if (b.Count > 0) { - if (i == Lion.Count - 1) + for (int i = 0; i < Lion.Count; i++) { - SetFace(i, 0); - } - else - { - SetFace(i, 2); + if (i == Lion.Count - 1) + { + SetFace(i, 0); + } + else + { + SetFace(i, 2); + } } } } diff --git a/Assets/Scripts/Games/Spaceball/Spaceball.cs b/Assets/Scripts/Games/Spaceball/Spaceball.cs index 18aa8b072..81a382113 100644 --- a/Assets/Scripts/Games/Spaceball/Spaceball.cs +++ b/Assets/Scripts/Games/Spaceball/Spaceball.cs @@ -94,6 +94,9 @@ namespace RhythmHeavenMania.Games.Spaceball { allCameraEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "cameraZoom" }); + if (allCameraEvents.Count == 0) + currentZoomCamDistance = -10; + if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0) { if (currentZoomIndex - 1 >= 0) diff --git a/Assets/Scripts/Games/Spaceball/SpaceballBall.cs b/Assets/Scripts/Games/Spaceball/SpaceballBall.cs index 605d9e6bd..f5c95f336 100644 --- a/Assets/Scripts/Games/Spaceball/SpaceballBall.cs +++ b/Assets/Scripts/Games/Spaceball/SpaceballBall.cs @@ -33,7 +33,7 @@ namespace RhythmHeavenMania.Games.Spaceball if (high) beatLength = 2f; float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.15f); - print(normalizedBeatAnim + " " + Time.frameCount); + // print(normalizedBeatAnim + " " + Time.frameCount); if (high) { diff --git a/Assets/Scripts/Games/Spaceball/SpaceballPlayer.cs b/Assets/Scripts/Games/Spaceball/SpaceballPlayer.cs index e6b82720d..3a6e64f99 100644 --- a/Assets/Scripts/Games/Spaceball/SpaceballPlayer.cs +++ b/Assets/Scripts/Games/Spaceball/SpaceballPlayer.cs @@ -37,7 +37,6 @@ namespace RhythmHeavenMania.Games.Spaceball anim = GetComponent(); } - int bruh; private void Update() { if (EligibleHits.Count == 0) @@ -47,12 +46,6 @@ namespace RhythmHeavenMania.Games.Spaceball { Swing(); } - - if (Conductor.instance.songPositionInBeats >= 5f && bruh == 0) - { - Swing(); - bruh++; - } } public void SetCostume(int costume) diff --git a/Assets/Scripts/WTF.cs b/Assets/Scripts/WTF.cs index aa2a7a6a4..5111835e2 100644 --- a/Assets/Scripts/WTF.cs +++ b/Assets/Scripts/WTF.cs @@ -6,8 +6,10 @@ namespace RhythmHeavenMania.Tests { public class WTF : MonoBehaviour { - private void FixedUpdate() + private void Update() { + this.gameObject.transform.rotation = Quaternion.Euler(0, 0, Mathf.Lerp(0, 360, Conductor.instance.loopPositionInAnalog)); + print(Conductor.instance.loopPositionInAnalog); } } } \ No newline at end of file diff --git a/Assets/cointoss.json b/Assets/cointoss.json new file mode 100644 index 000000000..97d3cfa19 --- /dev/null +++ b/Assets/cointoss.json @@ -0,0 +1,38 @@ +{ + "bpm": 120, + "entities": [ + { + "beat": 4, + "datamodel": "spaceball/shootHigh" + }, + { + "beat": 8, + "datamodel": "gameManager/switchGame/clappyTrio" + }, + { + "beat": 9, + "datamodel": "clappyTrio/bop" + }, + { + "beat": 10, + "datamodel": "clappyTrio/bop" + }, + { + "beat": 11, + "datamodel": "clappyTrio/prepare_alt" + }, + { + "beat": 12, + "length": 1, + "datamodel": "clappyTrio/clap" + }, + { + "beat": 16, + "datamodel": "gameManager/switchGame/spaceball" + }, + { + "beat": 21, + "datamodel": "spaceball/shoot" + }, + ] +} \ No newline at end of file diff --git a/Assets/cointoss.json.meta b/Assets/cointoss.json.meta new file mode 100644 index 000000000..0de114e9d --- /dev/null +++ b/Assets/cointoss.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 244c565c8088cfa4597e0ebda9c7de98 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/remix6.json b/Assets/remix6.json index 28562c333..95de866ec 100644 --- a/Assets/remix6.json +++ b/Assets/remix6.json @@ -2,40 +2,209 @@ "bpm": 135, "entities": [ { - "beat": 1, - "datamodel": "clappyTrio/prepare_alt" + "beat": 0, + "length": 0, + "valA": 170, + "datamodel": "spaceball/cameraZoom" + }, + { + "beat": 0, + "length": 4, + "valA": 10, + "datamodel":"spaceball/cameraZoom" }, { "beat": 4, + "type": 1, + "datamodel": "spaceball/shoot" + }, + { + "beat": 8, + "length": 42, + "valA": 30, + "datamodel": "spaceball/cameraZoom" + }, + { + "beat": 6, + "datamodel": "spaceball/shoot" + }, + { + "beat": 8, + "datamodel": "gameManager/switchGame/forkLifter" + }, + { + "beat": 8, + "datamodel": "forkLifter/pea" + }, + { + "beat": 11, + "datamodel": "gameManager/switchGame/spaceball" + }, + { + "beat": 11, + "type": 1, + "datamodel": "spaceball/costume" + }, + { + "beat": 14, + "datamodel": "spaceball/shoot" + }, + { + "beat": 16, + "datamodel": "gameManager/switchGame/clappyTrio" + }, + { + "beat": 17, "length": 2, "datamodel": "clappyTrio/clap" }, { - "beat": 12, - "datamodel": "clappyTrio/prepare_alt" + "beat": 22, + "datamodel": "gameManager/switchGame/spaceball" }, { - "beat": 13, - "length": 1, - "datamodel": "clappyTrio/clap" + "beat": 22, + "type": 2, + "datamodel": "spaceball/costume" }, - - { - "beat": 17, + "beat": 23, + "type": 1, + "datamodel": "spaceball/shootHigh" + }, + { + "beat": 26, + "datamodel": "spaceball/shoot" + }, + { + "beat": 28, + "datamodel": "spaceball/shootHigh" + }, + { + "beat": 28, + "datamodel": "spaceball/shoot" + }, + { + "beat": 28, + "datamodel": "forkLifter/pea" + }, + { + "beat": 29.5, "datamodel": "gameManager/switchGame/forkLifter" }, { - "beat": 17, - "datamodel": "forkLifter/pea" + "beat": 32, + "datamodel": "gameManager/switchGame/spaceball" }, { - "beat": 20, - "datamodel": "forkLifter/pea" + "beat": 34, + "datamodel": "spaceball/shoot" }, { - "beat": 20.5, - "datamodel": "forkLifter/pea" - } + "beat": 36, + "datamodel": "spaceball/shoot" + }, + { + "beat": 38, + "datamodel": "spaceball/shoot" + }, + { + "beat": 40, + "datamodel": "spaceball/shoot" + }, + { + "beat": 42, + "datamodel": "spaceball/shoot" + }, + { + "beat": 44, + "datamodel": "spaceball/shootHigh" + }, + { + "beat": 44, + "length": 2, + "valA": 170, + "datamodel": "spaceball/cameraZoom" + }, + { + "beat": 48, + "datamodel":"gameManager/switchGame/forkLifter" + }, + { + "beat": 50, + "datamodel":"forkLifter/pea" + }, + { + "beat": 53, + "datamodel":"forkLifter/pea" + }, + { + "beat": 57, + "datamodel":"gameManager/switchGame/spaceball" + }, + { + "beat": 57, + "length": 0, + "valA": 10, + "datamodel":"spaceball/cameraZoom" + }, + { + "beat": 57, + "datamodel":"spaceball/shoot" + }, + { + "beat": 59, + "datamodel":"spaceball/shoot" + }, + { + "beat": 61, + "datamodel":"spaceball/shootHigh" + }, + { + "beat": 63, + "datamodel":"spaceball/shoot" + }, + { + "beat": 65, + "datamodel":"gameManager/switchGame/clappyTrio" + }, + { + "beat": 65, + "length": 1, + "datamodel":"clappyTrio/clap" + }, + { + "beat": 68, + "datamodel":"clappyTrio/bop" + }, + { + "beat": 69, + "datamodel":"clappyTrio/prepare" + }, + { + "beat": 70, + "length": 1, + "datamodel":"clappyTrio/clap" + }, + { + "beat": 72.5, + "datamodel":"gameManager/switchGame/forkLifter" + }, + { + "beat": 73, + "datamodel":"forkLifter/pea" + }, + { + "beat": 75, + "datamodel":"forkLifter/pea" + }, + { + "beat": 77, + "datamodel":"forkLifter/pea" + }, + { + "beat": 79, + "datamodel":"gameManager/switchGame/spaceball" + }, ] } \ No newline at end of file diff --git a/Assets/spaceball.json b/Assets/spaceball.json index 8a4ce2621..a523ab7e6 100644 --- a/Assets/spaceball.json +++ b/Assets/spaceball.json @@ -1,10 +1,10 @@ { - "bpm": 105, + "bpm": 135, "entities": [ { "beat": 0, "length": 0, - "valA": 20, + "valA": 170, "datamodel": "spaceball/cameraZoom" }, { @@ -68,7 +68,7 @@ "datamodel": "spaceball/costume" }, { - "beat": 22, + "beat": 23, "type": 1, "datamodel": "spaceball/shootHigh" }, @@ -125,6 +125,14 @@ "length": 2, "valA": 170, "datamodel": "spaceball/cameraZoom" + }, + { + "beat": 48, + "datamodel":"gameManager/switchGame/forkLifter" + }, + { + "beat": 50, + "datamodel":"forkLifter/pea" } ] } \ No newline at end of file diff --git a/ProjectSettings/AudioManager.asset b/ProjectSettings/AudioManager.asset index 27287fec5..df1e8090a 100644 --- a/ProjectSettings/AudioManager.asset +++ b/ProjectSettings/AudioManager.asset @@ -12,6 +12,7 @@ AudioManager: m_DSPBufferSize: 1024 m_VirtualVoiceCount: 512 m_RealVoiceCount: 32 + m_EnableOutputSuspension: 1 m_SpatializerPlugin: m_AmbisonicDecoderPlugin: m_DisableAudio: 0