General code cleanup

This commit is contained in:
Starpelly 2021-12-22 21:28:05 -05:00
parent 575e47e384
commit 1a7b1b7e07
10 changed files with 686 additions and 442 deletions

Binary file not shown.

View file

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

View file

@ -138,7 +138,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &49975355
Transform:
m_ObjectHideFlags: 0
@ -1359,7 +1359,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 066f6ce2bdafdfb45a8df77dfb111c22, type: 3}
m_Name:
m_EditorClassIdentifier:
songBpm: 130
songBpm: 120
secPerBeat: 0
songPosition: 0
songPositionInBeats: 0
@ -1381,7 +1381,7 @@ AudioSource:
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 51af38323954a8d44874780ba4577fb4, type: 3}
m_audioClip: {fileID: 8300000, guid: ebc898cbaf3e679438e83c68552e527f, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
@ -3884,7 +3884,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1161847961
Transform:
m_ObjectHideFlags: 0
@ -6634,7 +6634,7 @@ MonoBehaviour:
playerEntities: []
currentEvent: 0
currentPlayerEvent: 0
txt: {fileID: 4900000, guid: cbe1a43c8ddc790498fde2e01e66d23e, type: 3}
txt: {fileID: 4900000, guid: 13908201c7935ea4c8e9d2a58b006b87, type: 3}
startOffset: 1
--- !u!212 &2072389418
SpriteRenderer:

View file

@ -6,7 +6,7 @@ namespace RhythmHeavenMania
[Serializable]
public class Beatmap
{
public double bpm;
public float bpm;
public List<Entity> entities;
[Serializable]
@ -14,6 +14,7 @@ namespace RhythmHeavenMania
{
public float beat;
public int track;
public float length;
public string datamodel;
public object Clone()

View file

@ -104,6 +104,12 @@ namespace RhythmHeavenMania
return final;
}
public void SetBpm(float bpm)
{
this.songBpm = bpm;
secPerBeat = 60f / songBpm;
}
public bool InThreshold(float beat)
{
//Check if the beat sent falls within beatThreshold

View file

@ -66,6 +66,10 @@ namespace RhythmHeavenMania
new GameAction("prepare", delegate { ForkLifter.instance.ForkLifterHand.Prepare(); }),
new GameAction("gulp", delegate { ForkLifterPlayer.instance.Eat(); }),
new GameAction("sigh", delegate { Jukebox.PlayOneShot("sigh"); })
}),
new MiniGame("clappyTrio", new List<GameAction>()
{
new GameAction("clap", delegate { Debug.Log("bruh"); }, true ),
})
};
@ -93,7 +97,7 @@ namespace RhythmHeavenMania
private void Update()
{
if (GameManager.instance.currentEvent > 0 && GameManager.instance.currentEvent < GameManager.instance.Beatmap.entities.Count)
if (GameManager.instance.currentEvent >= 0 && GameManager.instance.currentEvent < GameManager.instance.Beatmap.entities.Count)
currentBeat = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].beat;
}

View file

@ -34,16 +34,17 @@ namespace RhythmHeavenMania
SortEventsList();
string json = txt.text;
Beatmap.entities = JsonConvert.DeserializeObject<List<Beatmap.Entity>>(json);
Beatmap = JsonConvert.DeserializeObject<Beatmap>(json);
SortEventsList();
StartCoroutine(Begin());
GlobalGameManager.Init();
eventCaller = GetComponent<EventCaller>();
eventCaller.Init();
Conductor.instance.SetBpm(Beatmap.bpm);
StartCoroutine(Begin());
}
private IEnumerator Begin()

File diff suppressed because it is too large Load diff

10
Assets/theclappytrio.json Normal file
View file

@ -0,0 +1,10 @@
{
"bpm": 117.26,
"entities": [
{
"beat": 9,
"length": 3,
"datamodel": "clappyTrio/clap"
}
]
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 13908201c7935ea4c8e9d2a58b006b87
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: