mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 12:57:39 +02:00
General code cleanup
This commit is contained in:
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user